Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Trouble finding Main Method on other computers  (Read 1181 times)
0 Members and 1 Guest are viewing this topic.
Offline Sinuath

Junior Duke


Medals: 2



« Posted 2013-08-27 05:50:23 »

So i created an entry for the latest LD but i found out half of the people who try it can't even play it, i tested it on another machine and i got an error about it not being able to find the "main class: maze.maze."

Here's a public link to my latest attempt at getting it to work. I always tend to have a lot of trouble with exporting these jar's.

executable Jar:
https://dl.dropboxusercontent.com/u/11280780/Maze.zip

All of my code/Resources non-jar files:
https://dl.dropboxusercontent.com/u/11280780/maze%20game.zip

i'd appreciate any help on this i've been googling for hours to no avail.

Hey [you][/you], you should totally check out my boring Site ~ http://davediel.com/chris
Offline nerb
« Reply #1 - Posted 2013-08-27 06:41:27 »

I have NFI when it comes to things like this, but anyway...

Your package is named 'Maze'. Rename this to lower-case 'maze'. As directly quoted from the Java Tutorials: "Package names are written in all lower case to avoid conflict with the names of classes or interfaces". I'm guessing there may be a conflict between your package Maze, and your class Maze.

If that fails, start thinking about what is common between users for whom the program fails to run. I.e. OS, Java version etc.

nerb.

PS. Just for your reference, it runs fine for me. I'm running Windows 7 and Java SE 7u25.
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #2 - Posted 2013-08-27 08:14:25 »

Just tested it on my machine and had no problems (Java 7 - Arch Linux). If you could post the specific error code here, that would be helpful. Since it seems to work fine on some machines, but not others, I have a nagging feeling that it's going to come down to the minimum Java version not being met on the machines with the issues. Check to see the version of Java the "problem machines" are running if possible. Also, if you compiled this for Java 7, then be aware that there are still a lot of machines running version 6 of Java out there which can aggravate deployment problems if you don't plan for it.

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online HeroesGraveDev

JGO Kernel


Medals: 269
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2013-08-27 08:26:12 »

Probably outdated java.

Offline Sinuath

Junior Duke


Medals: 2



« Reply #4 - Posted 2013-08-27 08:34:54 »

Thanks guys, i'll try the maze thing nerb, and CodeHead That makes a lot of sense, can i compile this for java 6 without reinstalling java? or do i need to install an older version of java?

Is it possible that it's because i made it with a 64 bit machine and their running 32 bit?

Hey [you][/you], you should totally check out my boring Site ~ http://davediel.com/chris
Offline nerb
« Reply #5 - Posted 2013-08-27 08:56:24 »

I can't say I'm convinced it's a Java 7 issue. Sinuath's source doesn't appear to use any new Java 7 features that would be incompatible with older versions. Not to mention if it did, I'd expect the error to be different, and occurring elsewhere??? Surely older versions are still able to find the main class of a Java 7 program?

Nonetheless, let us know how you go Sinuath. Will be interesting and handy to know what the problem is.

Good luck!
nerb.
Offline davidc
« Reply #6 - Posted 2013-08-27 08:58:39 »

Can you post the exact error message?
Offline cylab

JGO Ninja


Medals: 52



« Reply #7 - Posted 2013-08-27 14:21:19 »

can i compile this for java 6 without reinstalling java?
http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#options
options -source and -target

If you compile using Eclipse, Netbeans or any other IDE you usually find a "source version" option in the project settings dialog.

Mathias - I Know What [you] Did Last Summer!
Offline KudoDEV

Junior Duke





« Reply #8 - Posted 2013-08-27 15:06:45 »

This happens when the computer's java version is older than the jar's java version.
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #9 - Posted 2013-08-27 15:20:36 »

@Cylab: Will that actually do any good in this situation? Looking at the javac version 7 options, I found the following:

Quote
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5), 1.6 (also 6), and 1.7 (also 7).
The default for -target depends on the value of -source:

If -source is not specified, the value of -target is 1.7
If -source is 1.2, the value of -target is 1.4
If -source is 1.3, the value of -target is 1.4
If -source is 1.5, the value of -target is 1.7
If -source is 1.6, the value of -target is 1.7
For all other values of -source, the value of -target is the value of -source.

From that it would sound like you could limit your source files to use only features available in Java 6, but the minimum target platform is still going to be Java 7. Huh

@nerb: Java is backwards compatible, not forward. Trying to run a newer .jar file in an older JVM usually causes Java to throw an exception on start-up. I can't recall the exact wording off the top of my head, but I've seen it happen plenty of times where I work when we deploy newer tools. Emo

@Sinuath: You can actually have multiple JDK's on the same machine at the same time. It's a bit of a pain to get set up at first, but I can say from experience it does work. The third answer down (and a few below that) on this SO page explains what needs to be done.

A much easier option would be to require Java 7 to play the game. If you're worried about end users not wanting to install/update their JRE, you can package a standalone version of Java with your application. There are more than a few threads around here explaining the process. Cool

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Ninja


Medals: 52



« Reply #10 - Posted 2013-08-27 15:38:35 »

@Cylab: Will that actually do any good in this situation? Looking at the javac version 7 options, I found the following:

Quote
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5), 1.6 (also 6), and 1.7 (also 7).
The default for -target depends on the value of -source:

If -source is not specified, the value of -target is 1.7
If -source is 1.2, the value of -target is 1.4
If -source is 1.3, the value of -target is 1.4
If -source is 1.5, the value of -target is 1.7
If -source is 1.6, the value of -target is 1.7
For all other values of -source, the value of -target is the value of -source.

From that it would sound like you could limit your source files to use only features available in Java 6, but the minimum target platform is still going to be Java 7. Huh

The versions listed are only the default values, if no explicit -target is specified. Specifying -source 1.6 and -target 1.6 works fine.

Mathias - I Know What [you] Did Last Summer!
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #11 - Posted 2013-08-27 16:15:52 »

@Cylab: Have you been able to successfully do this? I ask out of genuine curiosity since it would streamline my development pipeline at work.

The compatibility docs for Java 7 seem to indicate there is a binary level incompatibility between JRE6 and the class files produced by JDK7 (im assuming even with the source and target flags used for compilation). I would test it myself, but I don't have access to JDK7 on my work machine, and trying to get our ISD department to install software is a multi-day, multi-manager approval process. Shocked

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Offline cylab

JGO Ninja


Medals: 52



« Reply #12 - Posted 2013-08-27 16:34:52 »

@Cylab: Have you been able to successfully do this?

Didn't try...

The compatibility docs for Java 7 seem to indicate there is a binary level incompatibility between JRE6 and the class files produced by JDK7 (im assuming even with the source and target flags used for compilation).

The article only contains that

Quote
Version 51 class files produced by the Java SE 7 compiler cannot be used in Java SE 6.

The purpose of the -target switch is to set the version number to the correct JRE version (see http://en.wikipedia.org/wiki/Java_class_file#General_layout).

the doc also says
Quote
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5), 1.6 (also 6), and 1.7 (also 7).

Mathias - I Know What [you] Did Last Summer!
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #13 - Posted 2013-08-27 17:42:23 »

Hmm, looks like I will have to recommission one of my spare machines at home this week, and do some testing. Thanks for the tip, Cylab. Grin

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (61 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (46 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!