How To Export to JNLP in Eclipse - java

I watched today as someone painlessly exported a NetBeans java project to a JNLP file and HTML file that he could just copy to his web server. Making JNLP files by hand is slightly obnoxious, especially given the codebase parameter. I would love if I could do the same in Eclipse, but I can't seem to find such a function or a plugin which does this.
The only thing I've found is this article but I can't really parse it, it's a bit dense to me, for instance it mentions:
Ensure that the org.eclipse.equinox.launcher plug-in is in the feature or in one of the included feature;
But if that's even a grammatical sentence, I don't know how to ensure what it says.

Since I never did find an easy way to do it in Eclipse, I did one better, and made JNLPs easy to use on your server! I took the time to figure out the different little quirks that were confusing me, and decided that the necessity to manually specify an absolute codepath is obnoxious. So I wrote a PHP class which generates your JNLP file for you, so that you don't need to worry about the XML at all, and even better, you can use the exact same PHP file on a development server and a live server, or move it around, or whatever you'd like. It updates the codebase dynamically. Solved my problems.

I'm pretty sure that page you found is for developing Eclipse Plugins.
Why not just download NetBeans?

Related

Which order? ProGuard + JWrapper + Launch4J

I understand that StackOverflow is geared towards answering specific questions and avoiding subjective opinion. I feel that my question(s) have only one correct answer and therefore I’m posting here.
I’ve created a Java desktop app (JavaFX) which I plan to distribute for commercial use. I’ve read that Java code is easily reverse-engineered so it’s critical to obfuscate using something like ProGuard. I’d like to package my app so that users double click a .exe (which they download from my site) and then an installer is run like any standard software does. This appears to be outside the scope of ProGuard, but I’ve found JWrapper and Launch4J which both seem to provide similar functionality. Both claim to wrap jars into Windows native executables, show splash screens, include JRE, but I'm confused where they differ.
Specifically, I need the following:
Installation Wizard (namely to place the exe somewhere safe + make shortcut on desktop, and also add the EULA somewhere).
Add EULA (End-User License Agreement) which specifies user’s limitations
Web updates for the app (JWrapper seems to provide this using URL + build path)
Ability to protect the app (somewhat) using licensing (License3j seems promising).
Their features can be found here and here but only JWrapper mentions the ability to perform web updates and mentions desktop shortcuts (which I assume can also write a EULA.txt somewhere).
So, after I have finished writing code, in which order should ProGuard, JWrapper and Launch4j be applied? I’m guessing ProGuard first (to shrink, optimize and obfuscate) and then JWrapper and then Launch4j? Or only 2 of 3?
Feel free to also suggest additional methods, tools, or concepts which I may be missing. Thank you!
This question seems out of scope for Stackoverflow, but to answer it:
apply ProGuard first on your application, keeping the main method of your application
apply either launch4j or jwrapper (up to you to choose) on the jar processed by ProGuard

A couple of questions about Eclipse

I've been learning to program in Java and the one thing I'm having difficulty locking down is an IDE that I actually like! I tried NetBeans, but did not get on with it at all. I've recently been using CodeRunner, which I found on the Mac App Store. I like CodeRunner, but I worry that it might be a bit simplistic. So I've been thinking of trying Eclipse, but there are a couple of things I'm not quite sure about that hopefully someone here can answer.
First of all, I've tried installing Eclipse on my Mac and I'm baffled by the fact that it comes with a folder packed full of program files and not as just a packaged Mac app. I'm not entirely sure what to do with it; are there any Mac Eclipse users out there who can advise me?
My other query has to do with projects. I've worked with a couple of different Java books and they all recommend using a single project to hold all of the java files for the book. Can anyone explain why this is? I would prefer to keep my own folder structure, for example having a separate folder for each chapter. Would I just have a different project for each chapter instead, is that how this works?
My apologies if these are noob questions; I really want to get my head around Java, but need to be able to get comfortable with the IDE ideally first!
Many thanks.
1- you can just put it in the Applications folder and use it as a normal application ;)
2- I think it's better to organise stuffs from the same source (in this case your book) in the same project. You can then put each chapter in different packages

GWT/ JSP- how to run jsp

I am on a project that uses GWT/ eclipse/ SQL Developer and the guy who originally implemented it is no longer on the project. We have a normal WAR and everything but the jsp files are kept in a different environment. Anyone know why? Can they not be run through GWT?
The issue we are facing is the only way we have to test/ compile JSPs is to actually deploy it into DEV which takes a lot of time. So we are in need of being able to run JSPs locally.
I have been told someone used to use Jdeveloper to do this, but I am unfamiliar with it and the only YouTube tutorials are in a foreign language (in regards to using JSPs with JDeveloper 11g). Someone else suggested notepad/ Tomcat? Or yet another option would be to configure eclipse to run it with our current project in GWT?
I am not familiar with any of this being I am brand new to JSPs,Tomcat, etc. and am in desperate need of some help.
What is the best way to accomplish my needs and are there any guides/ tutorials to help me through the process?
My requirements are just to run a folder with 4 linked jsps and be able to connect to the database to provide the information.
"I am not familiar with any of this being I am brand new to
JSPs,Tomcat, etc. and am in desperate need of some help."
That's sounds true!
One answer about the different environments is that jsp needs "EE" .I.E. EclipseEE but the GWT app just uses plain old eclipse (like an eclipse helios release with GWT plugin).
Regarding your requirements, I can't understand them clearly enough to begin to provide helpful information, but good luck.
Tony

protecting applet code against hackers

I have a Java application that I am considering releasing over the web as an applet. I am concerned about java-savvy end users being able to somehow view the source code, given that my web server would be sending the code to their remote jvm when they try to use the applet.
What precautions can be taken to ensure that end users are never able to directly view source code of an applet?
I am hoping that release as an applet might somehow protect the privacy of the code more than releasing an application with downloadable jars that the user could just unzip. Is this true?
As a Jar is essentially just a zip file in disguise there's not really a way to keep people from viewing the source code. There are lots of decompilers available for Java classes. Most developers that are concerned about end-users decompiling the source code use an obfuscater to make the code more or less unreadable or at least difficult to understand.
Sorry there is not really a good answer to the question, it is just the nature of the Java language that you can always decompile the source code.
There are options like wrapping a Java application in an executable that will make it more difficult to access the Jar itself but obviously you can't do this for an applet.
Here's a (company) blog post on the topic of converting Java to an executable:
http://www.excelsior-usa.com/articles/java-to-exe.html
Pulled from an SO thread also on the topic:
How can I convert a JAR file to an EXE file?
You could use some of the available open-source code obfuscators (many people recommend using ProGuard, not only for obfuscating but also code minimization).
If somebody really wants your code, they'll get it. The best you can do is try to make it more difficult. As others have stated, a typical approach is to use a code obfuscator.
If you're using Maven to build your project you can use the proguard-maven-plugin from the maven central repository.
But since you're considering releasing it as an applet, if you can have any functionality running on server side code, you can go a lot farther towards securing your code base.

How to distribute Java-based software?

Now, don't get me wrong, I am a very competent programmer, but when I program, I typically develop things for the web using scripting languages like JavaScript, PHP, Python, SQL, etc. If I want to develop Java software (I am relatively experienced in Java), how do I distribute it?
Is there any good way to package up Java software in a nice little executable, send it out, and have it run? Alternatively, is there any good way to package up Java in some sort of installer, and send it out to be installed and run?
I'm using Launch4J http://launch4j.sourceforge.net/ it will generate an .exe executable for Windows, if the targeted system don't have JVM, it will tell user to download and get JVM.
You can package Java applications in so called jar-files using the jar tool or any competent Java IDE. These jar-files are self-contained and seldom need any installer.
These .jar files can easily be distributed and executed.
If you're used to web-development, you may also be interested in the Java Webstart technology.
Some links to get you started.
Export to a .jar-file in Eclipse
Lesson: Java Webstart
I have found two approaches to work well, depending on the needs of the end user.
1) Java WebStart - allows for central distribution and easy maintenance, but works best for online users. Require you to have a web site to locate the files - these days this is easy to do on the Google Application Engine.
2) Wrapping up the Java program in a single jar using one-jar, and then using jsmooth to generate an .EXE file which ensures Java is available, extracts the jar-file and invokes Java on it. This works well for users not always on the net, where you want the launch process to be transparent, but is less easy to upgrade than the webstart approach.
I use Maven to handle all the dependencies of my projects and that way when you utilise Maven to build your projects they will compile into one nice executable jar that contains everything so you dont need to worry about getting all your third-party jars in the right place etc.
There are a couple of ways: one is to create an installer that allows your user to install and run it. For this you can take a look at NSIS.... or you can just use Java Web Start where your user can just click the link and launch your application.
Here you will find a large set of options: Open Source Installers Generators in JavaIt is very useful for the "naive" customer or user of your application, to make the installation process as painless as possible. Let them install whatever is needed, DBMS, JVM, JMF and additional options via one installer.
You can also consider use one of the rich client platforms available for Java. The learning curve is probably a lot higher than just creating a jar file and ship it, but you will get a lot for free when it comes to distribution. (Think Eclipse with auto update through an update site).
Do a search for "Eclipse RCP" and "Netbeans RCP" and you'll find the two biggest contenders here. I also performed a serach for "eclipse RCP installer" and one of the hits seems interesting:
http://download.instantiations.com/RCPPackagerDoc/integration/latest/docs/html/gettingstarted/GenInstaller.html
I personally like izpack. It generates a jar file installer that you could wrap up in launch4j, supports things like windows specific shortcuts, is highly customisable through XML and hooks directly into ant.
OneJar is great for smaller stuff, but for larger programs or applications it's nowhere near as flexible and in my experience is rather slow.
Hello you can make an installer for your application.
In the link below you will find a nice help about izpack installer.
http://www.imrantariq.com/blog/?p=89
Link below contains a detailed pdf to make installer with izpack.
http://www.imrantariq.com/blog/?attachment_id=112
cheers

Categories