My BlueJ source code got deleted - java

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

Related

After rename file name site went down - Java

I am working on some server files in jboss. The main file of data jboss/standalone/deployments/data.tar and data.war I just renamed to data1.tar and data1.war and come back site went down. Again I renamed with data.tar still not working. I am unable to to figure out.
How to fix this am not java programmer, could some one help me
You renamed the application - what did you expect exactly? The server took that as (a) uninstallation of the application under the old filename and (b) installation of an application under the new filename.
Don't fiddle around with things like this.

.class file isn't syncing with .java file when debugging

I might be using the wrong term when talking about "sync" but that's the best way to descrie it I think. I'm trying to debug a project that I've been working on for a couple of days now but for some reason the .java class and the .class file aren't syncing (.class file isn't updating to any of the changes that I make to the .java class that I'm editing). Let me start from the beginning I guess, when I do add break points to my .java file (sometimes the breakpoints are skipped) that I'm debugging and run the debugger when the breakpoint is reached the .class file is opened in instead of the .java file.
I searched around and found the solution to that with the help of some topics on here, which was "Edit source lookup". So the part about .class opening instead of .java file instead was solved. The main problem now is when I do edit the .java file with anything and run the debugger it completely ignores my changes. For example, if I implement a System.out.println("Test: 1") before a breakpoint or even after it's not printing to the console. Another example is if I comment out a line of code and run the debugger, the debugger still executes that line of code that I just commented out.
I searched for some solutions but they didn't help much. Some things I've tried were but did'n work:
Why isn't Eclipse updating the classes?
1.) Make sure the Build automatically is checked
2.) Cleaning the project
3.) Refreshing the project, F5
4.) Go to Wwindows->Preferences->General->Workspace and making sure the first 2 checkboxes are checked.
5.) Saving
6.) Restarting ecslipse
If anyone knows how to maybe solve my propblem I will be indebted to you. By the way I'm using java 1.7
What you describe indicates problems in you project definition.
Make sure that your project (main runnable class) specifies correct dependencies - that it does not specify dependencies on other jar files but includes dependencies from your related projects

converting .class into .java

I deleted a Java project from my hard disk in an attempt to do some refactoring with Eclipse. Luckily I found a recent version of an Executable Jar File and decrompressed it into a bunch of .class files.
I've read some 'decompiling' threads on SO and tried showmycode.com, but I was hoping for more. Isn't it possible to convert .class files into the .java files that made them, comments included - nothing changed? Or find the in the .jar file? What are my best options if not? Other answers on the topic seem outdated. Do I need to download software?
You will not be able to get your comments back, they are lost when you go from .java to .class. As to how to do it any "Java Decompiler" can do it, your code will not be exactly what you wrote, however the code you get back will be functionally the same as what you originally wrote.
JD is a decompiler I have used before and have been happy with its output.

Lost resources after importing project in Eclipse

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
.

Executable jar file won't run after doing some updates

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 :)

Categories