Full java code from Netbeans Project - java

How can I get the full java code of a netbeans project? I have created a project for a contest, but need to submit the whole code. In Netbeans alot of the libraries and classes code is hidden. I need to submit all this. Even if a plugin needs to be installed.
Thank You :)

Assuming you have a NetBeans Project named HelloWorld in your system,let's assume that the default directory of storage of NetBeans Projects is in
C:\Users\USERNAME\Documents\NetBeansProjects\HelloWorld // On Windows OS
/home/NetBeansProjects/HelloWorld // On *nix(Linux,Unix) based OS
If it is different from the above,then please switch to the default directory of the Netbeans Projects.
Select your project folder from that,HelloWorld here.
It'll have several directories(folders) inside.
Switch over to src folder. All the .java files are placed in that directory. Those are the source code in Java. You can open and check and verify those files using any text-editor like Notepad,Gedit,etc.
NOTE :- DON'T DELETE ANY OTHER FOLDER/FILES unnecessarily,else,your NetBeans project won't be recognised/won't run properly.

Related

Importing .java and .class file gone wrong in eclipse

Recently I worked on a project on a mac, using eclipse. When I was done with the project I copied certain .java files and their corresponding .class files onto a USB drive and brought it to my personal computer. When I try to use the import feature on eclipse and import everything, my main method is not recognized by eclipse. It will work if I create a new eclipse "class" by the name I have in the program and copy paste the code. I have many classes so I can not do this for each one. Is there any way for me to change all .java/.class files into files that will be read by the system?
Thanks
An eclipse project contains a lot of meta information. Just open the project directory in a file browser, and have a closer look. There are files like .classpath for example.
When you just copy your source code, you leave all the meta information behind!
You should either copy the complete project directory, or simply use the export task to create a ZIP file of your project. (to later import that in other systems).
There is one other way you can do this. Just create a new project with the SAME EXACT PROJECT NAME that you did at school or wherever. After you create your project, go to your file explorer and navigate to the following place:
<"Directory to work-space">/<"Project Name">/src/
For ex: in Windows, it is Generally:
C:/Users/your_name/workspace/projectName/src
In here, copy all your ".java" files.
Now go to eclipse, right click on your project and hit refresh. You will find all your .java files there. Right-click on your project and hit "Run"->"Run as a Java Project". It should run! hope this helps.
PS: You do not need your class if you are executing it in Eclipse. Eclipse will create its own class files.

IntelliJ IDEA one project - two operating systems

So I am creating a java project with a friend of mine, he is using windows and I am using ubuntu. I didn't give it much thought because java is cross-platform but I am having trouble opening the project I cloned from our git repo that he created in windows. The file browser recognizes the project but when I open the folder with the intelliJ icon it only opens the iml file and the class files, but not the folders and I don't have a hierarchy on the left tab. So I am wondering if it is a problem with our OS or if its some problem with intelliJ.
How did you set the project up with Git? You should only be pushing your source files, and all others (such as the .iml) should be ignored. That way, any person using any OS or any IDE can easily set it up on their own.
Try removing all your files from git besides the source files. Now, if you clone it and set it up with IntelliJ, any IntelliJ specific files should stay locally, and only source files will be pushed.

To create an eclipse project from just the folders

I work in an organisation where i am provided with a folder having codes and other things for particular application.
I want to open this folder in eclipse and be able to navigate to all the classes that are used through resources(ctrl + click).
The problem is when I imported the folder the eclipse worked same as that of a notepad. Any changes no error would be shown.
I even added the required jar files for that project.
What should I do? I just need to navigate and check out the classes that are used and declared. Pls Help.
P.S. - I work on Ubuntu Machine.
If you have a java project, you may need to configure the source directory(s).
This can be done by right clicking on your folder -> Build Path -> Use as Source Folder.

Missing CDT builder / how to tell eclipse that a project includes some C++

I have a fully working pure java project and a fully working Java & C++ sample project in the same workspace. I decided to copy some of the C++ elements from the sample project and get them working in my previously java only project.
Eclipse seemed to know about how to handle the C++ parts in the sample project. Indeed I could delete the .so file in the libs/armeabi-v7a and then ask eclipse to rebuild the project and hey-presto a new .so file would appear and the program could then run again. Unfortunately the same could not be said of my original project. Eclipse seemed not to know what to do with the files in /jni, i.e. clicking on build project would not create an .so file (though I could create the so file from a DOS command line by typing ndk-build). Looking at the properties of the two projects I noticed that in the sample project, under "builders", it listed (amongst other things) a "CDT Builder" whereas in my original project it was not listed. I assume that this is the cause of the problem, but I can not work out how to get CDT Builder listed in my original project's properties.
Solved: Highlight project name in eclipse, then right-click and select android tools > Add native support. Then add a dummie name for a library and click finish. This dummie name will appear with a cpp extension in the project's /jni directory. The CDT builder is now associated with the project. You can then delete the dummie file if you don't plan to use it.

giving 'java.library.path' in netbeans for .dll/.so files

How do i give the path for the .dll or .so file in netbeans to load the library using
System.loadLibrary("Foo")
I read this on netbeans page but couldn't help me. as it gives the unsatisfied link error.
These are the two things i tried :
In the following snapshot i created a lib folder inside the netbeans project and placed the dll files inside it.
In the second snapshot i created a lib folder inside the modules folder and placed all the dll files inside lib folder as stated in the link.
But both of them give me unsatisfied link error exception. How do i set java.library.path in netbeans so that i can directly test the application from netbeans,
without having to go and write on the terminal ?
Its working now. Some little bit setting you have to do with your Netbean IDE.Only of Netbean IDE.
Follow the Steps :-
==>Right click on the Project
==>Properties
==>Click on RUN
==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
==>Ok
Its working 100%. I have done this in my own project.
I'm using Mac OS X Yosemite and Netbeans 8.02, I got the same error and the simple solution I have found is like above, this is useful when you need to include native library in the project. So do the next for Netbeans:
1.- Right click on the Project
2.- Properties
3.- Click on RUN
4.- VM Options: java -Djava.library.path="your_path"
5.- for example in my case: java -Djava.library.path=</Users/Lexynux/NetBeansProjects/NAO/libs>
6.- Ok
I hope it could be useful for someone.
The link where I found the solution is here:
java.library.path – What is it and how to use
To me JDeveloper's suggestion didn't work. However, the method that I came across this early afternoon works handy.
It is for netbeans 8.02, and Visual Studio 2013 generated dll.
create a package(eg, "dll") under [Source Packages] node of netbeans
project
put/copy a dll file(eg, simpleDLL.dll) into the package(eg,
"dll")
on the [Libraries] node of the netbeans project, right-click
and choose "Add Jar/Folder...",
navigate to the folder("src") that contains the folder("dll") for the package that you created in step 1 above (it could be "...\src\dll" in my example), select package folder("dll") and click [Open] button to select it.
-- now you should have added a folder("dll") (which contains the dll file{simpleDLL.dll}) to the Libraries node of the project.
That's it. It should work!
Good luck.
IF you are working on "NetBeans Modules"
DLLs or SOs can be placed in the folder release/modules/lib/ in a module project's sources (look in the Files tab). This will make them appear in the final NBM or application in a lib subdirectory beneath where the module's JAR resides. Then just use System.loadLibrary as usual.

Categories

Resources