beginner to java - how to run outside jcreator/netbeans ?

Hi,

Im new to Java, started this year in university. I was just wondering, after making this card game, how can i get it to run outside the program im using to create it (jcreator or netbeans). I heard I had to make it a jar file, tried it still didnt work.

Any help is greatly appreciated,

[311 byte] By [Altimimia] at [2007-10-2 6:25:30]
# 1

look in the javadocs under tools for java.exe. that's the jvm that actually runs your java application.

if the .class file that contains the main method you want to run is in package foo.bar and named Bat.java, you'll open a command shell, navigate to the parent directory of the foo directory, and run it like this:

java -classpath .;path-to-jar1.jar;path-to-jar2.jar foo.bar.Bat

Note the "dot" at the start of the CLASSPATH. You have to add each 3rd party JAR individually, of course.

%

duffymoa at 2007-7-16 13:27:19 > top of Java-index,Java Essentials,New To Java...
# 2

> Hi,

> Im new to Java, started this year in university. I

> was just wondering, after making this card game, how

> can i get it to run outside the program im using to

> create it (jcreator or netbeans). I heard I had to

> make it a jar file, tried it still didnt work.

> Any help is greatly appreciated,

--that's the reason why I dont suggest to use any IDE when starting to learn in Java.

angeles1016a at 2007-7-16 13:27:19 > top of Java-index,Java Essentials,New To Java...
# 3

In order run programs manually you need to know

Where on your disk is your class file.

What the package line (if exists) at the top of the .java file says

if you subtract one from the other, this is your class path.

assuming MyClass.class is found at c:\a\b\c\MyClass.class

and the package line says

package b.c;

then you would do

java-classpath c:\ab.c.MyClass

dmbdmba at 2007-7-16 13:27:19 > top of Java-index,Java Essentials,New To Java...
# 4
[url= http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html]This tutorial[/url] explains step by step how to write, compile and run a Java program without using an IDE.
jesperdja at 2007-7-16 13:27:19 > top of Java-index,Java Essentials,New To Java...
# 5
Thanks for your help everyone...Fahad
Altimimia at 2007-7-16 13:27:19 > top of Java-index,Java Essentials,New To Java...