Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2010, 08:23 AM
twiggy62's Avatar
Member
 
Join Date: Feb 2010
Posts: 26
Rep Power: 0
twiggy62 is on a distinguished road
Default Can you run files without a package?
I have a bunch of old .java files that I have created in the past and I used cmd
to compile them. But since then that computer no longer works and and my
new computer apparently has problems with me trying to set up cmd to work
with the compiling of the files. So I installed NetBeans.

Like if I use: file>open file>example.java

Is there anyway to run a java file with building a package for it?
__________________
The biggest room in the world, is room for improvement.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 02-09-2010, 08:38 AM
Senior Member
 
Join Date: Aug 2009
Posts: 1,895
Rep Power: 2
r035198x is on a distinguished road
Default
Originally Posted by twiggy62 View Post
I have a bunch of old .java files that I have created in the past and I used cmd
to compile them. But since then that computer no longer works and and my
new computer apparently has problems with me trying to set up cmd to work
with the compiling of the files. So I installed NetBeans.
...
You should have added the path to your JDK's bin folder to your environment's PATH variable.


Originally Posted by twiggy62 View Post
..

Is there anyway to run a java file with building a package for it?
Do you mean without building a package?
Why don't you want to put the classes in a package?

You'll need to study the buttons on your Netbeans tool bar to find out how to run a class.

Basically you are trying to avoid learning things that you should be learning.

1.)First you couldn't figure out how to set the PATH correctly to include javac and java. Instead of reading and learning about it, you switched to an IDE.

2.)Now you think Netbeans requires classes to be in packages and are avoiding learning about packages by asking how to run without declaring them.
3.) Well, how to do that requires that you learn how to use Netbeans.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-11-2010, 09:02 AM
Senior Member
 
Join Date: Mar 2009
Location: USA
Posts: 117
Rep Power: 0
Aseem is on a distinguished road
Default
if you dont wanna create package, it will go on default package. But it is still a package.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 02-12-2010, 12:59 AM
twiggy62's Avatar
Member
 
Join Date: Feb 2010
Posts: 26
Rep Power: 0
twiggy62 is on a distinguished road
Default
Actually, I do know how to set my path to refer to the java and javac, cause I
did it on my other computer just fine. I made a batch file that consisting of:

"path = %path%,C:\Program Files (x86)\Java\jdk1.6.0_17\bin"

so that it properly would refer to java and javac files (which are located in this
bin. Then I would change my directory to the folder with all my java files are
located, but still received errors when trying to compile, saying: that it did not
recognize the java or javac.

Maybe it's because I am using a Mac with parallels to link to my Windows
side, (I did notice VS2008, had issues with this as well, but I got that
resolved).

Well, thanks, I'll just keep working with NetBeans, it is much better than
compiling with cmd anyways.
__________________
The biggest room in the world, is room for improvement.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 02-12-2010, 08:54 AM
Senior Member
 
Join Date: Apr 2009
Posts: 944
Rep Power: 1
Tolls is on a distinguished road
Default
Do you have a JDK installed on your Mac then?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 02-13-2010, 01:09 AM
twiggy62's Avatar
Member
 
Join Date: Feb 2010
Posts: 26
Rep Power: 0
twiggy62 is on a distinguished road
Default
Yes, I do have the jdk installed on my Mac, but on the Windows OS side of my Mac, but that shouldn't matter if I am using cmd from Windows right?
__________________
The biggest room in the world, is room for improvement.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 02-15-2010, 08:50 AM
Senior Member
 
Join Date: Apr 2009
Posts: 944
Rep Power: 1
Tolls is on a distinguished road
Default
So is this a Mac OS, or a windows OS?
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The declared package does not match the expected package oneforall Eclipse 7 11-09-2009 08:51 AM
package statement in java files won't run outside of eclipse rdtindsm New To Java 5 03-21-2009 06:19 PM
working with files (text files) itaipee New To Java 1 02-24-2009 12:38 PM
Behaving text files like binary files Farzaneh New To Java 2 08-27-2008 04:20 PM
how to convert mpeg files to .wav files christina New To Java 1 08-06-2007 05:14 AM


All times are GMT +2. The time now is 04:29 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org