• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

NetBeans - how to add java files

I want to compile a .java file but netbeans seems to prompt me to
create a new project first. Do i always need to create a new
project before i can compile the java files?

I created a new project, how do i add the pre-completed .java files in..
0
jedistar
Asked:
jedistar
  • 3
1 Solution
 
hoomanvCommented:
Do i always need to create a new project before i can compile the java files?

yes. you can add your java files to currently generated projects too

> how do i add the pre-completed .java files in..

netbeans takes responsibility to compile java source files for you
0
 
hoomanvCommented:
sorry
what do you mean by pre-completed .java files ?
0
 
hoomanvCommented:
you mean how to add existing source codes in existing projects ?

I think there is no general way to do this
one way is to create an empty class file and copy/paste the content of the existing source into it

another way I have just found, is simply copy/paste the source file into sproject's src folder, and it will be added to netbeans automatically
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
>> how do i add the pre-completed .java files in..

I think you have a .class file is it or you just have a java file which is out of the project.

ok assuming you have a java file what you need to do is create a java file with samr name and package structure and add the content of the existing file to it later.(beacuse netbeans doen't allow you to copy and paste the file).

if you have a .class file the if you want to use this is writing some other program which makes use of this .class file then you include it in the libraries folder of you created new project.

Thank You.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now