Running from other Computers

Hey,How would I build an executable or run a game on another computer built with JCreator?
[104 byte] By [GilGalvantia] at [2007-11-27 5:18:52]
# 1
Jar file.BTW, why are you running from the computers, are they attacking you?
floundera at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 2
You really can't escape Skynet, you know.
paulcwa at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 3
> BTW, why are you running from the computers, are they> attacking you?[url #" style="display: block; background-image:url(' http://www.angryflower.com/mycomp.gif'); width:534px; height: 470px] [/url]
CaptainMorgan08a at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 4
Haha. Im thinking "holy hitler" might replace "nazi pope" as mymake believe punk band's name.
TuringPesta at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 5
For a punk band wouldn't "Holy Hitler's Gonads" be better?
floundera at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 6
How did you get JCreator to build a computer?
DrClapa at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 7
> How did you get JCreator to build a computer?or to do anything at all...
jwentinga at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 8

Ok this is a really trivial question to yal but I really dont know.

@CaptainMorgain08

How do you add a picture direcly into your post?

I wanted to do the same but didnt know how to go about it

in my following thread

http://forum.java.sun.com/thread.jspa?threadID=5174630

I would appreceate it, cause it may come handy later on for me and many others.

Thanks in advance

ArcherKinga at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 9

> Ok this is a really trivial question to yal but I

> really dont know.

>

> @CaptainMorgain08

>

> How do you add a picture direcly into your post?

> I wanted to do the same but didnt know how to go

> about it

> in my following thread

>

> http://forum.java.sun.com/thread.jspa?threadID=5174630

>

>

> I would appreceate it, cause it may come handy later

> on for me and many others.

>

> Thanks in advance

Don't ask Captain Morgan - Sun forum's very own Jeremy Beadle - for advice on posting, and don't ever click on any pictures you see in his posts. Or links. In fact, don't even read his posts since he's probably worked out a way to make your optical nerve turn inside out or something by now

georgemca at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 10
> How do you add a picture direcly into your post?Just click "Reply" to that post, then click "Quote." It doesn't do anything other than display an image.
CaptainMorgan08a at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 11
> Jar file.> > BTW, why are you running from the computers, are they> attacking you?And what is the Jar file, where do I find it, what does it do, what do I do to run it?
GilGalvantia at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 12
Thanks I think I've got it. Let me give it a try ;)[url #" style="display: block;background-image:url(' http://www.geocities.com/lijoethomas/thanks.gif'); width:461px; height: 57px] [/url]
ArcherKinga at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 13
can anyone help me with getting it to run on other computers?
GilGalvantia at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 14

> can anyone help me with getting it to run on other

> computers?

Well it doesnt specifically matter that you compiled your program in JCreator. IDEs are just special tools for writing code but the code is still compiled into .class or .jar files.

Therefore, If youd like to distribute your program to another computer you need 2 things:

(1) JRE (java runtime environment)

(2) Your compiled code (in the form of .class files or .jars)

So basically what im saying is copy and paste your class files, lol.

TuringPesta at 2007-7-12 10:42:06 > top of Java-index,Java Essentials,New To Java...
# 15
> can anyone help me with getting it to run on other> computers?The vagueness of your question rends the very fibers of my soul.
Djaunla at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 16
so where is the JRE file that I need? Do I just double click it and it will run?
GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 17
http://java.sun.com/docs/books/tutorial/deployment/jar/
kevjavaa at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 18
Jeebus H Christ!I guess typing "Jar file" into Google was too much fuking hard work.
floundera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 19
> Jeebus H Christ!> > I guess typing "Jar file" into Google was too much> fuking hard work.Sorry...
GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 20
when I looked it up it's telling me to create it with commands in a directory, but I'm confused, it's talking about the directory like it should be obvious what its talking about, but I have no idea what it means. What directory do I type it into?
GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 21

Assuming you are using Windows:

Use Notepad / whatever other text editor you want to create your .java file.

Save it.

Open up a command prompt.

you'll probably see something like:

C:\Documents and Settings\YourName>

Now, when you clicked "File --> Save" from your menu, you saved it into a specific folder (directory). Lets assume you saved it to C:\ for sh*ts and giggles.

To compile this file and to create a jar, follow this steps:

From the prompt, type:

CD C:\

your prompt will now read:

C:\>

type in the following:

javac [the name of your java file].java

Assuming there are no errors, you will see this line again:

C:\>

Now, in order to make an executable jar file (i.e. one that you can "double-click" and execute) you need to make a manifest file. Re-open Notepad and type the following:

Manifest-Version: 1.0

Main-Class: [my filename]

(Make sure you put the blank line at the end.)

Save it to C:\ with the .java file you created earlier. Call it manifest.mf

Go back to your command prompt which should still read:

C:\>

Type in the following:

jar -cvfm MyJar.jar manifest.mf *.class

You'll get some information about adding a manifest file and the names of the classes that are in that directory.

To test whether or not your jar file assembled correctly, type the following:

java -jar MyJar.jar

If it executes, you're good to go.

If you have any further questions, let me know. I'll do what I can to give you a hand.

Navy_Codera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 22
I am using JCreator by the way if that matters.
GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 23

For the sake of my example, do the following:

Open Notepad

open Notepad and type the following:

public class Test {

public static void main(String[] argv) {

System.out.println("This is a test...");

}

}

Click file-->save.

Save it to C:\ and call it Test.java

use that for the example I just gave you in my previous post.

Navy_Codera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 24

> Assuming you are using Windows:

> Use Notepad / whatever other text editor you want to

> create your .java file.

> Save it.

> Open up a command prompt.

> you'll probably see something like:

> C:\Documents and Settings\YourName>

>

> Now, when you clicked "File --> Save" from your menu,

> you saved it into a specific folder (directory).

> Lets assume you saved it to C:\ for sh*ts and

> giggles.

> o compile this file and to create a jar, follow this

> steps:

> From the prompt, type:

> CD C:\

>

> your prompt will now read:

> C:\>

> type in the following:

> javac [the name of your java file].java

> Assuming there are no errors, you will see this line

> again:

> C:\>

>

> Now, in order to make an executable jar file (i.e.

> one that you can "double-click" and execute) you need

> to make a manifest file. Re-open Notepad and type

> the following:

> Manifest-Version: 1.0

> Main-Class: [my filename]

>

> (Make sure you put the blank line at the end.)

> Save it to C:\ with the .java file you created

> earlier. Call it manifest.mf

>

> Go back to your command prompt which should still

> read:

> C:\>

>

> Type in the following:

> jar -cvfm MyJar.jar manifest.mf *.class

>

> You'll get some information about adding a manifest

> file and the names of the classes that are in that

> directory.

> To test whether or not your jar file assembled

> correctly, type the following:

>

> java -jar MyJar.jar

> If it executes, you're good to go.

>

> If you have any further questions, let me know. I'll

> do what I can to give you a hand.

Thanks for the help, but I'm having some problems with it. Following your directions directly caused me to have some problems. First, when I type javac, it says it is an unrecognized command, internal or external. I continued anyways, and created the manifest file in notepad, saved it, changed the name to manifest.mf, then typed " jar -cvfm MyJar.jar manifest.mf *.class" into the console, but it said, jar is not recognized as an internal or external command.

GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 25
You will need to set your classpath. If you don't know how, do a search.
floundera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 26

No problem, all you have to do is set up your path variable.

From windows, go to My Computer.

Go to C:\Program Files\

Look for a folder called Java

Double click on it.

Then look for a folder called JDK1.X.X_XX where X's will be replaced with a number.

Remember this folder name.

Click on the Start menu.

Click Settings

Click Control Panel

Make sure you are in "Classic View"

Double click on the System icon

Click on the Advanced Tab

click on the Environment Variables button

click on the Path listing

click Edit

Remember that folder that you found your JDK in?

Append this to the end of your path listing:

;c:\program files\java\[the folder that you found, exactly as you typed it]

Make sure that there is a semi-colon (;) between your entry and the last entry in the list of paths.

Click on.

Close out of that.

Open a new command prompt.

type in CD C:\

retry the javac part and then the jar -cvfm part.

Navy_Codera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 27

> No problem, all you have to do is set up your path

> variable.

> From windows, go to My Computer.

> Go to C:\Program Files\

> Look for a folder called Java

> Double click on it.

> Then look for a folder called JDK1.X.X_XX where X's

> will be replaced with a number.

> Remember this folder name.

>

> Click on the Start menu.

> Click Settings

> Click Control Panel

> Make sure you are in "Classic View"

> Double click on the System icon

> Click on the Advanced Tab

> click on the Environment Variables button

> click on the Path listing

> click Edit

>

> Remember that folder that you found your JDK in?

> Append this to the end of your path listing:

> ;c:\program files\java\[the folder that you found,

> exactly as you typed it]

>

> Make sure that there is a semi-colon (;) between your

> entry and the last entry in the list of paths.

>

> Click on.

> Close out of that.

> Open a new command prompt.

> type in CD C:\

> retry the javac part and then the jar -cvfm part.

Arghh...still not working, sorry :S. I did everything you said and double checked it. Still says the same error :/

GilGalvantia at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 28
Repeat for classpath.
floundera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 29

First, close the command prompt you have open right now.

Then open a new one.

Then type:

echo %PATH%

Does it show the addition that you just made through the control panel?

If it does, then retry the javac and jar commands.

If not - then double check the spelling in your path. It may be that you've typed something incorrectly.

Navy_Codera at 2007-7-21 21:25:13 > top of Java-index,Java Essentials,New To Java...
# 30

This is what it says:

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>echo %PATH%

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Tec

hnologies\ATI.ACE\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jd

k1.6.0_01\;C:\Program Files\Common Files\AOL\System Information

C:\Documents and Settings\Owner>javac

'javac' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\Owner>jar

'jar' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\Owner>

Thanks for the help :)

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 31
I'm so sorry ... that was my fault...When you set the path on the control panel, it should have been:c:\program files\java\jdk1.6.0_01\binSorry about that. Fix that, restart your command prompt and you'll be in business. Dense moment, there.
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 32

> I'm so sorry ... that was my fault...

> When you set the path on the control panel, it should

> have been:

>

> c:\program files\java\jdk1.6.0_01\bin

>

> Sorry about that. Fix that, restart your command

> prompt and you'll be in business. Dense moment,

> there.

Awesome, it works now, thanks a ton for your time and help :).

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 33
Sure thing.
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 34

sorry to bother you again, but I just went back and tried everything again, and the javac works, but the jar part won't work, this is what i did:

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>C:\program files\xinox software\JCreatorV3LE

'C:\program' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\Owner>cd C:\program files\xinox software\JCreatorV3LE

C:\Program Files\Xinox Software\JCreatorV3LE>jar -cvfm MyJar.jar manifest.mf*.cl

ass

java.io.FileNotFoundException: manifest.mf*.class (The filename, directory name,

or volume label syntax is incorrect)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.<init>(FileInputStream.java:106)

at java.io.FileInputStream.<init>(FileInputStream.java:66)

at sun.tools.jar.Main.run(Main.java:131)

at sun.tools.jar.Main.main(Main.java:1022)

C:\Program Files\Xinox Software\JCreatorV3LE>

With the manifest file, I just opened a new notepad, typed this:

Manifest-Version: 1.0

Main-Class: Test.java

and saved it as "manifest.mf"

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 35
on this line:jar -cvfm MyJar.jar manifest.mf *.classput a space between the .mf and the *.class
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 36

Ahh, stupid me :P. Thanks, it compiles without error, but *sigh* it says it failed when I try the next line:

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>C:\program files\xinox software\JCreatorV3LE

'C:\program' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\Owner>cd C:\program files\xinox software\JCreatorV3LE

C:\Program Files\Xinox Software\JCreatorV3LE>jar -cvfm MyJar.jar manifest.mf*.cl

ass

java.io.FileNotFoundException: manifest.mf*.class (The filename, directory name,

or volume label syntax is incorrect)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.<init>(FileInputStream.java:106)

at java.io.FileInputStream.<init>(FileInputStream.java:66)

at sun.tools.jar.Main.run(Main.java:131)

at sun.tools.jar.Main.main(Main.java:1022)

C:\Program Files\Xinox Software\JCreatorV3LE>jar -cvfm MyJar.jar manifest.mf *.c

lass

added manifest

adding: Test.class(in = 419) (out= 287)(deflated 31%)

C:\Program Files\Xinox Software\JCreatorV3LE>java -jar MyJar.jar

Failed to load Main-Class manifest attribute from

MyJar.jar

C:\Program Files\Xinox Software\JCreatorV3LE>

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 37

oops, forgot the blank line in the manifest file, but yet another error now,

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>C:\program files\xinox software\JCreatorV3LE

'C:\program' is not recognized as an internal or external command,

operable program or batch file.

C:\Documents and Settings\Owner>cd C:\program files\xinox software\JCreatorV3LE

C:\Program Files\Xinox Software\JCreatorV3LE>jar -cvfm MyJar.jar manifest.mf*.cl

ass

java.io.FileNotFoundException: manifest.mf*.class (The filename, directory name,

or volume label syntax is incorrect)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.<init>(FileInputStream.java:106)

at java.io.FileInputStream.<init>(FileInputStream.java:66)

at sun.tools.jar.Main.run(Main.java:131)

at sun.tools.jar.Main.main(Main.java:1022)

C:\Program Files\Xinox Software\JCreatorV3LE>jar -cvfm MyJar.jar manifest.mf *.c

lass

added manifest

adding: Test.class(in = 419) (out= 287)(deflated 31%)

C:\Program Files\Xinox Software\JCreatorV3LE>java -jar MyJar.jar

Failed to load Main-Class manifest attribute from

MyJar.jar

C:\Program Files\Xinox Software\JCreatorV3LE>

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 38
This:Main-Class: Test.javaShould be:Main-Class: Test
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 39
Wow, it actually works, three hours later, lol. Thank you for all your help again :).
GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 40
Glad I could help.Happy coding!
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 41
just a question, if the project is 2D and run by an HTML file, would I run it by double clicking the file?
GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 42
> just a question, if the project is 2D and run by an> HTML file, would I run it by double clicking the file?Do you mean an applet? If it's an applet, then no - you will not double click on it. You could double-click on the HTML file and it will load in the browser
Navy_Codera at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 43

> > just a question, if the project is 2D and run by

> an

> > HTML file, would I run it by double clicking the

> file?

>

> Do you mean an applet? If it's an applet, then no -

> you will not double click on it. You could

> double-click on the HTML file and it will load in the

> browser ...

I tried that but it just opens a blank page, even though it runs fine from JCreator :S

GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 44
Okay, I tried it with some of the examples that came with JCreator, and I can get their html files to run, but when I edit the code and try to run it again, it still runs the original code. Any ideas why?
GilGalvantia at 2007-7-21 21:25:18 > top of Java-index,Java Essentials,New To Java...
# 45
Anyone?
GilGalvantia at 2007-7-21 21:25:23 > top of Java-index,Java Essentials,New To Java...
# 46
Have you tried the [url= http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/appletviewer.html]AppletViewer[/url]? That might help. Eliminates issues like browser cache.
kevjavaa at 2007-7-21 21:25:23 > top of Java-index,Java Essentials,New To Java...