Need help compiling & executing

S

SharkD

Could someone please help me compile and run this program under
Windows XP?

http://github.com/Atmospherian/Haxer




I was able to compile without any reported errors using this command
line:

"C:\Program Files\Java\jdk1.6.0_16\bin\javac.exe" "src\net\interaxia
\haxer\translator\BaseTranslator.java" "src\net\interaxia\haxer
\translator\Translator.java" "src\net\interaxia\haxer\scanner
\Inspector.java" "src\net\interaxia\haxer\scanner\Scanner.java" "src
\net\interaxia\haxer\api\AllTypes.java" "src\net\interaxia\haxer\api
\ObjectType.java" "src\net\interaxia\haxer\api\Property.java" "src\net
\interaxia\haxer\HaxeFile.java" "src\net\interaxia\haxer\Haxer.java"




Then I tried unsuccessfully to run the program using this command
line:

cd "src\net\interaxia\haxer\"
"C:\Program Files\Java\jdk1.6.0_16\bin\java.exe" Haxer




I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: Haxer
(wrong name: ne
t/interaxia/haxer/Haxer)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass
(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:
260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
320)
Could not find the main class: Haxer. Program will exit.




What did I do wrong?

-Mike
 
M

markspace

SharkD said:
cd "src\net\interaxia\haxer\"
"C:\Program Files\Java\jdk1.6.0_16\bin\java.exe" Haxer

It looks like the name of the class is net.interaxia.haxer.Haxer, so
you'll have to do this:

cd src
java -classpath . net.interaxia.haxer.Haxer

The main thing you did wrong is to just give the name "Haxer". You do
have to use the full name.

The other bit is the classpath, which I think will work for the Haxer,
but Haxer won't be able to find any of the other classes unless you tell
it to "look here", which is what the . does.
 
S

SharkD

It looks like the name of the class is net.interaxia.haxer.Haxer, so
you'll have to do this:

cd src
java -classpath . net.interaxia.haxer.Haxer

The main thing you did wrong is to just give the name "Haxer".  You do
have to use the full name.

The other bit is the classpath, which I think will work for the Haxer,
but Haxer won't be able to find any of the other classes unless you tell
it to "look here", which is what the . does.

Alright! Some progress!

I did what you said, but now I get a new different error:


J:\ProgsWin\Haxer>cd "src"

J:\ProgsWin\Haxer\src>"C:\Program Files\Java\jdk1.6.0_16\bin\java.exe"
java -cla
sspath . net.interaxia.haxer.Haxer
Exception in thread "main" java.lang.NoClassDefFoundError: java
Caused by: java.lang.ClassNotFoundException: java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
320)
Could not find the main class: java. Program will exit.

J:\ProgsWin\Haxer\src>pause
Press any key to continue . . .
 
M

markspace

SharkD said:
J:\ProgsWin\Haxer\src>"C:\Program Files\Java\jdk1.6.0_16\bin\java.exe"
java -cla
sspath . net.interaxia.haxer.Haxer
Exception in thread "main" java.lang.NoClassDefFoundError: java


You shouldn't use both "java.exe" and "java". Use one or the other. Do
you not have a PATH set to your bin directory?


J:\ProgsWin\Haxer\src>"C:\Program Files\Java\jdk1.6.0_16\bin\java.exe"
-classpath . net.interaxia.haxer.Haxer

if you don't have your PATH set, I guess.


It would also help at this point if we could see where your class files
are. Some dir and pwd listings would help.
 
S

SharkD

You shouldn't use both "java.exe" and "java".  Use one or the other.  Do
you not have a PATH set to your bin directory?

That was the problem.

Thanks very much everyone for your help! It works now.

-Mike
 
R

Roedy Green

I was able to compile without any reported errors using this command
line:

see http://mindprod.com/jgloss/helloworld.html

http://mindprod.com/jgloss/javacexe.html

http://mindprod.com/jgloss/javaexe.html

http://mindprod.com/jgloss/classpath.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

On two occasions I have been asked [by members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
~ Charles Babbage (born: 1791-12-26 died: 1871-10-18 at age: 79)
 
R

Roedy Green

cd src
java -classpath . net.interaxia.haxer.Haxer

The main thing you did wrong is to just give the name "Haxer". You do
have to use the full name.

The other bit is the classpath, which I think will work for the Haxer,
but Haxer won't be able to find any of the other classes unless you tell
it to "look here", which is what the . does.

The trick is . must point to the directory above net, not to the haxer
derictory.
--
Roedy Green Canadian Mind Products
http://mindprod.com

There is one brain organ that is optimised for understanding and articulating logical processes, and that is the outer layer of the brain, called the cerebral cortex. Unlike the rest of the brain, this relatively recent evolutionary development is rather flat, only about 0.32 cm (0.12 in) thick, and includes a mere 6 million neurons. This elaborately folded organ provides us with what little competence we do possess for understanding what we do and who we do it.
~ Ray Kurzweil (born: 1948-02-12 age: 61)
 
R

Roedy Green

if you don't have your PATH set, I guess.

Perhaps a C lover could knock out a JDK install polisher that did the
following:

set JAVA_HOME
put JDK bin on the path
set up the association between jnlp and javaws.exe
set up the association between jar and java.exe
Check the registry an tell you which JDK it though was current.
do a quick sanity check to make sure all the pieces are in place and
intact (e.g. compute a CRC checksum of every file in the latest
distribution)


These are all very windows-specific tasks.
--
Roedy Green Canadian Mind Products
http://mindprod.com

There is one brain organ that is optimised for understanding and articulating logical processes, and that is the outer layer of the brain, called the cerebral cortex. Unlike the rest of the brain, this relatively recent evolutionary development is rather flat, only about 0.32 cm (0.12 in) thick, and includes a mere 6 million neurons. This elaborately folded organ provides us with what little competence we do possess for understanding what we do and who we do it.
~ Ray Kurzweil (born: 1948-02-12 age: 61)
 
R

Roedy Green

Perhaps a C lover could knock out a JDK install polisher that did the
following:

set JAVA_HOME
put JDK bin on the path
set up the association between jnlp and javaws.exe
set up the association between jar and java.exe
Check the registry an tell you which JDK it though was current.
do a quick sanity check to make sure all the pieces are in place and
intact (e.g. compute a CRC checksum of every file in the latest
distribution)

I have written this up in more detail as a student project at
http://mindprod.com/project/jdkpolish.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

There is one brain organ that is optimised for understanding and articulating logical processes, and that is the outer layer of the brain, called the cerebral cortex. Unlike the rest of the brain, this relatively recent evolutionary development is rather flat, only about 0.32 cm (0.12 in) thick, and includes a mere 6 million neurons. This elaborately folded organ provides us with what little competence we do possess for understanding what we do and who we do it.
~ Ray Kurzweil (born: 1948-02-12 age: 61)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top