I've been writing my java in a text-editor, compiling and running my code with a batch-file. I'd put all my resources (.png-files) in the bin-folder for my classes to read.
this is the structure of the map.
MyProject
bin
src
batch-file
After 8 months of coding in Notepad, I finally decided to give an IDE a chance and went with Eclipse. I created a project called MyProject, having understood that was the way to import existing source code. Next thing I know, my .png files doesn't exist anywhere on my computer (I can't find them with Windows search function) I am very upset and angry and regret having deployed Eclipse at all. Can someone PLEASE give me good news and tell me how to get those lost resources back?
No good news my friend...if you decided to do that big jump you should read something about how eclipse (or another ide) organizes projects....specifically the result of incremental compiler (classes) are written (by defaults) in a directory called... bin!.. probably that's the reason why you're not finding your files...you lost them
.
Related
it's been a while since i've been working with java and especially with eclipse. My professor sent me a huge folder with many subfolders and subsubfolders, that mainly contain .class java files. Now I'm supposed to work on these files, but i just can't seem to figure out how to get all of them working. I found a few solutions for single class files, but i have a whole folder hirarchy here that i want to work on.
I hope you can help me - I read something about decompiling? How does that work?
Note that I have around 50 different files here that need to be accessible.
Thank you very much!
I suppose the class you are attending is not something like "CS 902 - Reverse Engineering", because if that was the case, you would know what to do with the .class files.
So, one of the following holds true:
Your professor has made a mistake, and instead of sending you the java files, he/she sent you the class files instead.
Your professor sent you the entire project, which contains both .java and .class files, and for some reason you have only managed to find the .class files, while the .java files are there, and you just haven't found them. Unfortunately, the convention in the java world is to store .class files in a subfolder under the project root, so if you copy the project folder, you are copying .class files together with everything else.
Your assignment is to write new code which makes use of classes and interfaces supplied by your professor, but your professor does not want you to have the source code of those files. In this case, you can still work with the .class files, because the public definitions contained therein are parseable by Eclipse and usable in your project, without any reverse engineering. So, what you need to do is to find a way to tell eclipse that these .class files form a "Class Library" which is supposed to be used by your project, and then go ahead and develop new .java files making use of the library. I don't remember how this is done in Eclipse, but you should be able to find it out by yourself, or look it up, or perhaps someone else might post a how-to answer. However, at this point we do not even know whether this is in fact what you need to do.
You can use a java decompiler like JD-GUI, you can find it at http://jd.benow.ca/ . This is a very handy tool to have when you want to view a decompiled version of your jar. There are plugins available for eclipse and intellij as well.
I was doing my school project today when suddenly my java BlueJ crashed and both my current file and my backup file got deleted.
One of my most important classes(SignIn.java) got deleted(only the source code).
While executing, it still works as it is linked but i can't find the source code to make changes or print it. There is a file with #BACKUP which might help me.
Is there anyway i can retrieve it? I spent almost 6 hours on this class and it took a lot of work.
As you can see in their manual at page 42 the #backup file is always saved in the same directory so your #backup file should be gone.
If you versioned it with svn or alike in the Team menu you can get Project History.
Otherwise.... you can use some file recovery programs.
The most popular can search for source codes in many languages.
The advantage of this approach is that you will recover comments meanwhile you won't by decompiling.
If your source code is truly gone (non-recoverable) you can try to use a de-compiler against the .class file. Jad and FernFlower are two that I've used and work pretty well.
https://github.com/fesh0r/fernflower
http://www.javadecompilers.com/jad
Disclaimer:
Before I get the standard "this has been asked 1000 times", let me say that yes, I know. I have read and read and read. Looked at JarJar and One-JAR but the problem is: I am self-taught with only a couple of months of experience under me and I am not familiar with Ant or Maven or anything other than vanilla Java. I use NetBeans as my compiler, just to add.
I have written an application for use at my job. It is just a small app that takes certain input and writes it to an Excel file. I downloaded jexcelapi (jxl.jar) and placed that appropriately. I have no trouble running the file inside of NetBeans or from within the dist/ folder after it is built. Therein lies the problem: if I move the app to, say, the Desktop, I get an error from the JVM saying "A Java Exception has occurred." I know that this is due to the fact that the main class is added to the .JAR automatically but to add another lib, I will have to make a "Class-path" statement within my Manifest. I tried that unsuccessfully. I have tried moving the actual jxl.jar file to my jdk folder and I tried calling the entire file path that points directly to the jxl.jar file into my Manifest. The closest I can get is building the .JAR in NetBeans and it adds the lib folder to the dist folder where the app .JAR is.
I want to distribute this app as just a single .JAR without having to send all the users a copy of the jexcelapi lib. It doesn't have to be a .JAR within a .JAR; it can be whatever way is easiest and simplest. As stated before, I am not familiar with Ant and One-Jar draws on that. I am still learning; can someone point me in the right direction with this? Thank you!
There is a better one for novice programmers.
Launch4j gives what you need, even wraps it to exe file. Yu don't need to know programming at all to use this.
OFC there are ANT task if you ant to automatise the Launch4j , but for that you must leant a bit about ANT :)
After hours of exhausting search, I found something that was incredibly short, sweet, and right to the point. You cannot mess it up. Here is the link.
I have a fairly large Eclipse project that has undergone several major refactorings over the past 6 months. Packages have been added, deleted, renamed (using Refactor >> Rename), and the same for source files within those packages.
Today I wanted to get a count of how many source files I had under the project root and was startled by what AgentRansack returned. I was expecting something on the order of 200 - 250, but it turned back ~325. I started looking at the list of files, and, sure enough, some of them were Java files I deleted eons ago.
I opened up Windows Explorer and took a gander at my project directory, and of course, saw them all just sitting there on my file system, like nothing ever happened to them.
Obviously, Eclipse is rendering a "view" (of some sort) of my project directory, and is using some kind of metadata to mark "deleted" ones, renamed ones, etc. But to the file system, nothing is changing.
Ordinarily I wouldn't be upset about this, but I just went to import a class that used to be pacakged as org.me.myproj.fizz.Widget, but was later refactored to be packaged as org.me.myproj.buzz.Widget. When I hit the shortcut (Ctrl+Shift+O), Eclipse asked me which Widget I wanted - but the first one shouldn't even exist anymore!!!
When I'm deleting packages/folders/files in Eclipse, or if I'm renaming/moving them via Refactor >> Rename/Move, how do I make sure the changes are permanent to the underlying file system??
I am working on Java project (A terraria like sandbox game) and I have come across something that I just don't understand. I have been exporting the project as .jar's as I go along to upload and share with my friends, but the last time I did this, the .jar won't run, but when I run it in eclipse, it runs fine. When I try to run the jar all it does is lose focus on the explorer window for a split second, then goes back. I have tried many things, like changing the main class, changing the META, and moving the files to specific packages, but nothing is working.
The project is 9 classes, so I won't paste all the code for it here, but the latest, non-working source code can be found here (http://www.mediafire.com/?fiw6wq73j7cff4t), the non-working jar here (http://www.mediafire.com/?bhjo162oh3hi2j9), and the working jar here (http://www.mediafire.com/?h918s8xpyxw4psr). If someone with more experience in java could please take a look at this it would be much appreciated.
One of the things I tried was not adding the JPanel (the game), and just leaving the splash screen, and the jar worked. This shows that it must be a problem in the coding somewhere.
Thanks for the time,
I.D.
Couldn't find message comes from your ReadMap class. So check which circumstance leads to this error. Most likely you did not add all classes or other files to your JAR, so file is not found. Check that all needed files are added to exported JAR in Eclipse export dialog. It's also a good idea to provide more debugging info (stacktrace is ok), especially when you are studying. BTW, cool game :)