Welcome, Guest. Please login or register.
Did you miss your activation email?
Pages: [1]   Go Down
  Print  
Author Topic: creating exe  (Read 1345 times)
0 Members and 1 Guest are viewing this topic.
jazz2k8
Yo Maaan Cheer Up...
Member
*

Reputation: 0
Offline Offline
Posts: 82
Referrals: 0

WWW Awards
« on: August 12, 2008, 03:13:15 AM »

i know it does not follow java's primary rule(i.e.Write once run anywhere) but i need to create n exe for my program ..

I've gone through with JSmooth...but getting some errors:
Code
GeSHi (java):
  1. Exception in thread "main" java.lang.NoClassDefFoundError: samp/class
  2. Caused by: java.lang.ClassNotFoundException: samp.class
  3.        at java.net.URLClassLoader$1.run(Unknown Source)
  4.        at java.security.AccessController.doPrivileged(Native Method)
  5.        at java.net.URLClassLoader.findClass(Unknown Source)
  6.        at java.lang.ClassLoader.loadClass(Unknown Source)
  7.        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  8.        at java.lang.ClassLoader.loadClass(Unknown Source)
  9.        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  10. Press any key to continue . . .
Created by GeSHI 1.0.7.20

Here is my java class:
Code
GeSHi (java):
  1. public class samp {
  2.  
  3.    public static void main(String srgs[]){
  4.        System.out.println("First Java Prog");
  5.    }
  6.  
  7. }
  8.  
Created by GeSHI 1.0.7.20

can anybody helpme how to create an .exe for this??
Logged

visit my blog: www.yoteam.co.cc
jurka
Moderator
Member
*
*

Reputation: 5
Offline Offline
Posts: 188
Referrals: 0

Awards
« Reply #1 on: August 12, 2008, 07:34:59 AM »

use jars instead exe's
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2593
Referrals: 13

WWW Awards
« Reply #2 on: August 12, 2008, 08:01:38 AM »

use jars instead exe's

I agree, create jars instead of exe. If you use Eclipse there is a plugin called "fatjar" that I use myself to create jars http://fjep.sourceforge.net/ but if you really want to create an self executable exe file you can try this (taken from mindprod)

Code
GeSHi (cpp):
  1. #include <process.h>
  2. int main(void)
  3. {
  4. execlp("java.exe",
  5. "java.exe",
  6. "-cp",
  7. "foo.jar",
  8. "Bar",
  9. NULL);
  10. return 0;
  11. }
Created by GeSHI 1.0.7.20

Or
Code
GeSHi (cpp):
  1. #include <process.h>
  2. int main(void)
  3. {
  4. execlp("java.exe",
  5. "java.exe",
  6. "-cp",
  7. "foo.exe",
  8. "Bar",
  9. NULL);
  10. return 0;
  11. }
Created by GeSHI 1.0.7.20

and after compiling:
rename foo.exe littlefoo.exe
copy /b littlefoo.exe + foo.jar foo.exe

But this still needs the Java JRE to run so i don't see the point of creating an exe above a Jar file.
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
jazz2k8
Yo Maaan Cheer Up...
Member
*

Reputation: 0
Offline Offline
Posts: 82
Referrals: 0

WWW Awards
« Reply #3 on: August 12, 2008, 08:20:27 AM »

Its Done with JavaExe................thnx for ur time and support
Logged

visit my blog: www.yoteam.co.cc
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here