Click to See Complete Forum and Search --> : How can a java app run trought an icon?
nievesj
Nov 27th, 2000, 02:42 PM
How can a java app run trought an icon?, i mean, there is no .exe for the application, but how do i run it without the commandline, and outside of any compiler?, just make it work like if it were a .exe, i click it and the app runs.
Is there a way?
Thanks.
I've been successfull with creating a shortcut and editing its "Target" and "Start in" values. I use javaw to be windowless.
Target
path2javaw.exe -cp path2Classes ClassNameWithoutDotClass
Example:
D:\jdk1.3\bin\javaw.exe -cp D:\Dwight\prog\java\chess\classes Chess
and this in Start in:
path2Classes
Example:
D:\Dwight\prog\java\chess\classes
My main concern is in deploying it to another machine that may not have the java version I used. Which minimal files do I need to deploy? I posted a question here about that.
If the system cannot find all the classes being used, you're out of luck.
nievesj
Nov 27th, 2000, 07:09 PM
I did it, but javax dosnt seem to find the "main" in the class... it is obiously there...
any ideas?
Post the error message.
In the 'Target', "-cp" tells java.exe or javaw.exe (as I used) where to find the classes; 'Start in' also "points" to that same directory of classes.
Do you get the same error if you take a dos prompt and start in the "Start in" directory and type the command you have in "Target"?
nievesj
Nov 28th, 2000, 06:09 PM
I did it using the shortcut, the os told me that the virtual machine coudnt be initialized.
I also did it trought the DOS and the OS told me that cant find the main class, it is there, i dont have any problem running it trought jbuilder or Forte for java.
What am i doing wrong?
I suggest that you find out how your IDE is calling your program or better yet, find out how to do it all from a dos prompt and notepad.
Pick a directory, lets call it c:\src that will hold your java source file named YourClass.java. From this directory type notepad YourClass.java and allow it to create a new file by this name (read the popup window--should hit YES).
If javac.exe is installed in c:\jdk1.3\bin\
Then from a dos prompt at c:\src type c:\jdk1.3\bin\javac YourClass.java
This should create YourClass.class in the c:\src directory as long as it is a simple java source file.
Next type c:\jdk1.3\bin\java YourClass and notice that I omitted the .class part. This runs your program. Had you typed javaw instead of java, it would run without a window (as may be preferred if your program is a window itself (or Frame object).
If you can do this, then you can use the shortcut technique I said. If you read the instructions when you install java.sun.com Java (assuming this is your brand of Java), all you should have to worry about is setting the "path" and "classpath", then you don't have to type the absolute path to java and javac; you can just type javac MyClass.java and java MyClass. As you advance, you will separate your source files from your class files and manage packages in a better directory structure than having everything in c:\src.
Good Luck.
nievesj
Nov 29th, 2000, 09:43 PM
Thanks a lot!!!!!
Finally i got it right hehe, im a little slow :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.