How do I use ProGuard for Eclipse Java desktop applications? - java

I just installed ProGuard for Eclipse (http://marketplace.eclipse.org/content/proguarddt), curious about how to protect my exported .JAR program from decompilation. However, I don't have the faintest idea how to use this.
When I search around, all I see is how to use it with Android. But I am just making a desktop Java application.
They all speak of some sort of configuration file, but I don't know where to put it or how to create it or how to use it.
At How do I use ProGuard? he mentions a .pro file, but in Where do I find proguard.cfg in my project? they talk about a .txt file? I am too confused at this point.
I have an Eclipse project. It is a Java desktop application. It has a number of apache-commons libraries in its build path. It also uses JavaFX (if that makes a difference). There is only one main method in a class called "App".
Can you explain to me how to use ProGuard in Eclipse for such purposes?

Have a look at examples here suitable for your application type: http://proguard.sourceforge.net/manual/examples.html#application
This answer can give you the start:
https://stackoverflow.com/a/2124256/1129313
Here is the usage of proguard: http://proguard.sourceforge.net/manual/usage.html
Another helpful link: http://www.thegeekstuff.com/2008/06/protect-your-java-code-from-reverse-engineering/

Related

How to integrate external packages in java?

I'm trying to develop an app that uses Bluetooth technology, so I need javax.bluetooth & javax.obex & javax.microedition packages. I've downloaded it but I don't know how to properly place it and where so the Java can see it while compilation. How do I integrate it?
It depends on what tool you're using to create your jar. For example: Maven, Eclipse or IntelliJ. Usually you can find an answer that is relevant to your build method by simply googling it.
However, if you want to permenantly add them to your JDK, you'll have to paste them in your JDK's integrated jre into the following folder: \jre\lib\ext
For me that would be:
C:\Program Files\Java\jdk1.8.0_231\jre\lib\ext
As you can see, I added RXTX (a serial comm library) to mine and I can now use it in my code.

How to create an executable jar in Android Studio?

I have Java project in Android Studio. I am able to launch and test it from Studio, but I have no idea of how to build it and get an executable jar file. Need help how to do that. I see some jar files in the "build/libs/" directory but thats not what i need.
So first of all Android Studio is the official integrated development environment (IDE) for Android platform development and for Java projects (as well).
Yes you can create and execute java projects hassle free but when it comes to making a Java Archive or an executable JAR then it becomes really unpleasant (there's no easy way to do this). But if you still want to go for it then maybe this will help you.
Anyways being a Java/Android programmer myself I prefer doing tasks on separate IDEs. For Java I use Eclipse-Neon. Exporting a JAR, or an exec-JAR learn how.
If you're adamant about using the Studio then I'd recommend you to start new by choosing java module as the project type.
Hope this helps.
Thanks

How to make an Executable ".exe" file from a java Code

I have an application that works fine and that I can execute from a .jar file. But I want to know how to make it runnable from any computer even if there is no JRE or the JRE version is not the good one. I thought about a .exe file but don't know how to do it.
I made my code with Eclipse and it use jxl,jdom and jfx librairies.
I tried to use Inno Setup 5.5.6 but when in Eclipse I run my build.xml as Ant Build it return me an error that says :
"'Launching JFX Build - Myapp' has encountered a problem.
The achive : C:/Program%20Files/eclipse/plugins/org.eclipse.swt.win32.win32.x86_64_3.104.0.v20150528.jar which is referenced by classpath, does not exist."
JavaFX provides specific utilities for bundling your application as a native package, which is referred to as "Self contained application packaging". These utilities are provided as a command-line tool, or as ant tasks. Additionally, the common IDEs support this via wizards, either out of the box (NetBeans) or via a plugin (e(fx)clipse for Eclipse). The details of how to use any of these are far beyond the scope of a stack overflow question, but the basic documentation is available here. A tutorial for e(fx)clipse is here.
Briefly, for e(fx)clipse, you should double-click the build.fxbuild file that is created in your project. Under the "Overview" tab, find the "Packaging format" option, and select "All" (or the specific type of package you want to create).
Note that you can only create a package targeted at the platform on which you are building, so if you want to create packages for windows, Mac, and Linux, you will need access to all three types of machine.
I know I am late. I faced same problem a trick worked for me. Look at the given directory in the error message. It contains a space (C:/Program Files/...). Move your e(fx)clipse to another directory where the directory doesn't contains any space.
Not sure it will work your everyone or not but it worked for me.
Thanks
There are various tools that let you wrap your Java application in a Windows executable. Some tools are only simple installers, others allow you to bundle your application with a specific JRE version.
A widely used but commercial tool is install4j, but there is a bunch of other tools, such as WinRun4J.

Java lib to change the icon used by an .exe

We have a netbeans-platform application, that creates a custom runnable .exe with the default NetBeans icon - as you can guess, when customers install it, they are not happy.
This NetBeans Wiki article and this NetBeans Bug (closed as wontfix) indicate that the platform can't do it natively, and suggest the use of a third-party executable to do it.
However, having a binary executable in our svn repo being called by maven during build time leaves me (and my boss) quite unhappy.
Is there a library in Java, preferably available in maven, that can change the icon an .exe file uses?
EDIT: Upon further research, I found this SO question... that wasn't answered either.
EDIT2: We are also not looking for another packager that can create an .exe for us. We are happy with the default NetBeans' Platform one, and it's already quite well integrated with our dev/release cycle.
It's not a library that accomplishes what you want, but the closest I could find was this - it'll read PE files and it's open source and Java. You may be able to look through the source to find the code that you need.
If you are already using maven you might use launch4j for creating an .exe. There is a maven plugin available. You also might take a look at this netbeans plugin.
Is there a reason you're not simply calling Window.setIconImages() on startup, and loading some images, possibly stored right within the JAR?

Trouble installing Boilerpipe

This is the third time I've installed it. I had it working on Windows, and up until a few days ago on Linux. I've done all I can do and I don't understand how to run this Java program.
The source code is a folder with a lib, src some jars and a classpath and project file.
The classpath file makes some declarations like classpathentry=src/main and path=lib, path=src.
All of these make sense. There is a folder 'main' inside 'src'.
The tiny file I'm trying to run starts off by
import de.l3s.boilerpipe.demo
I'm trying to run 'Oneliner.java'. I cannot compile it.
No matter what/where that class file is, I cannot run it. It results in a noclassdeffound.
I've run it in the main, the src, the root, the demo, the ... anywhere.
I've tried compiling it in different directories, running it with various java command line switches that were recommended. Supposedly you can have it 'search' for the file, which I've yet to experience. The sheer stubbornness of this java environment is terrifying. And massively humiliating for me.
I had the same problem with installing it. The 'Getting Started' page is poor quality.
My solution was to use a python wrapper, which you can find here: https://github.com/misja/python-boilerpipe
It takes care of all of the dependencies you'll need (however, you might be missing jpype if you're on a Mac. In that case, you'll need to install it manually from: http://jpype.sourceforge.net/).
The best way to start using the boilerpipe algorithm (and to see what it is for) is to use the demo site:
http://boilerpipe-web.appspot.com/
If you want to integrate the boilerpipe library into your applications, or even intent to modify/improve the code, you will definitely need solid Java programming skills.
As a quick-start I suggest that you install a recent version of the Eclipse IDE for Java Developers and import boilerpipe-core as a project. This avoids pretty much of the classpath configuration, and almost everything should be set up correctly for you.
The classpath file you mentioned is probably ".classpath", which is part of the Eclipse project configuration. You don't need it unless you want an Eclipse project.

Categories