home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

creating Java application

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2689
Discussions: 200,998, Posts: 2,379,985, Members: 246,368
Old June 4th, 2004, 07:12 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jun 2004
Posts: 1
creating Java application

I just finished a Java programming class in high school, but we never did cover how to make Java programs stand on their own. I've checked out books, but they don't help. If it is possible to do make them stand on their own I would really appreciate help. Thxs.
JavaGuy is offline   Reply With Quote
Old June 4th, 2004, 07:15 PM     #2 (permalink)
Ultimate Member
 
lost-and-found's Avatar
 
Join Date: Oct 2001
Location: Illinois
Posts: 2,977
Send a message via AIM to lost-and-found
yes, the format is a little different. For example you need to create a main function. I don't remember it anymore since I took java a few years back.......but it surely is possible.
__________________
lost-and-found is offline   Reply With Quote
Old June 4th, 2004, 08:15 PM     #3 (permalink)
may contain mild peril
 
SpookyEddy's Avatar
 
Join Date: Oct 2001
Location: UK
Posts: 3,329
Assuming you are using a unix based system:

Simple source code (I am not a Java programmer, as you will soon be aware)...
Code:
public class Foo
{
  public static void main(String[] args)
  {
    System.out.println("get bent");
  }
}
Turn the source into byte code...
Quote:
ed@Slacker:/tmp$ javac Foo.java
ed@Slacker:/tmp$

Et voila!
Quote:
ed@Slacker:/tmp$ java Foo
get bent
ed@Slacker:/tmp$

Regards

ed
SpookyEddy is offline   Reply With Quote
Old June 6th, 2004, 05:03 PM     #4 (permalink)
Ultimate Member
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: Pasadena, CA
Posts: 2,177
yes you need a main function that will run the code, and any corresponding classes you wish to run. You will need to compile the class with the main method in it just like any other class too.

If you're using a windows environment and you're NOT using an IDE such as Borland JBuilder or Eclipse, then you'll need to run the programs form a command prompt. For example, to compile a java class in a command prompt window you just type

javac [class_name].java

then to run it its just

java [class name]


Quite simple. Of course, if you are using packages it takes an extra annoying step but its not difficult at all. It seems weird to me that your teacher would teach you how to create a class but not teach you how to properly run that class.
__________________
YAH! I knew you'd be jealous
Tekk is offline   Reply With Quote
Old June 6th, 2004, 08:19 PM     #5 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
I don't understand what it means to make a java program stand on its own.
Creosote is offline   Reply With Quote
Old June 6th, 2004, 08:57 PM     #6 (permalink)
It's the cheese guy! ¬_¬;
 
paul9's Avatar
 
Join Date: Aug 2003
Location: Gateshead U.K.
Posts: 9,167
Send a message via MSN to paul9 Send a message via Yahoo to paul9
basically so you could just run the program like you would a normal .exe file, creosote.
paul9 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
NetBeans & .exe's / bin files torac Linux and Unix 4 February 11th, 2004 01:10 AM
Java help needed badly! FreSan Webmastering and Programming 1 May 21st, 2003 11:09 PM
java trouble dezzzi28 Technical Support 7 September 24th, 2002 09:33 PM
Winderz won't run Java lost-and-found Applications and Operating Systems 4 July 3rd, 2002 01:00 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3104)
‘Rogue’ or ‘Rouge’? (8)
Charges against non-tippers dropped.. (22)
Foxconn Blackops x48 MoBo (5)
Nvidia GTX 260 problem (14)
Delete an OS (18)
Laptop with wireless problem. (13)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
windows vista security holes (19)
[F@H SPAM 11/16/09] ! 1/2 months to.. (41)
windows 7 problem (7)
Recent Discussions
Computer shutting down on its own (6)
EVGA 9800 gtx help with finding a goo.. (13)
"Documents and Settings" fo.. (7)
Delete an OS (18)
Outputing 1080p from my PC to my 720p.. (0)
panasonic dmr ez48veb recorder (0)
add ram to existing (3)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Laptop with wireless problem. (13)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)
FreeAgent drive software not x64 comp.. (1)
Intel 5100 AGN issues fixed yet? (28)
Foxconn Blackops x48 MoBo (5)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (41)
Print spooler problem (17)
Q9650 vs. Q9550 (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Size after cutting 700Mb file is 2.5 .. (0)
windows vista security holes (19)


All times are GMT -4. The time now is 01:25 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28