Integrating python webapp with some jar files - java

Hi I have few jar files which are few calculations compiled into jar files. I have a python web app which is supposed to interact with these jar files and get me the data. I have heard that it can be done using the java bridge. Can someone let me know how this could be done or at least point me to the right link.

I think what you are looking for is jython.You can interact back and forth between python and java using jython.

You could always run the jar files in a subprocess and use PIPE for IO (or temp files). This works pretty well for us (we are generating PDF from our Django app with flying saucer and iText)

Related

Convert netbeans project with embedded databases to a stand alone java program

I have a very complex java program written with net beans 7.1. It consists of 1 .java file that has a main(), and over 25 supporting .java files (most used for routines inside of tabs). In addition there are 15 different databases (embedded) associated with it. The program is virtually complete, and I need to export this project to a stand-alone Java application (including the databases) that is completely independent of net beans and may run on any system that supports Java. This is intended to be a desktop application, not a web based program.
I am a fairly experienced programmer, however this is my first attempt in writing programs in java. If I could get links that may provide step-by-step procedures and/or examples that would be the most help. Or even better if there are software apps out there that would take the net beans code and generate a executable program.
Any assistance or advice will be greatly appreciated.
You must try out a free software named 'JavaExe' which can convert jarfiles (or java classes)
directly into .exe
Vikrant
(India)
When you build it, the stand-alone program should appear in a "dist" folder.
If you have problems with running this program, I am afraid, you have to write your own ant/maven script.

Does coverting a JAR file to an executable secure it for distribution?

I've made an application in Java, and I've converted the application jar file to an .exe using software to prevent extraction, since we know that JAR files can be easily extracted and de-compiled.
Can anyone please tell me whether converting the .jar file to .exe is safe enough for distributing to any clients.
Nothing is 100% safe. Converting jar to exe you are killing the super important java feature: cross-platform. Exe file is not cross platform any more. It is created for specific platform (e.g. MS windows).
If you want to prevent your code from reverse engineering use obfuscation: the process that changes your byte code so that it probably can be decompiled but it is extremely hard to understand it after de-compilation. If you want more security you can download parts of your code at runtime and run them. The downloading can be done using SSL, so it will be very secure. You can also create your custom class loader and run against password protected zip file.
So, there are a lot of ways to protect your code and creating exe file is the weakest one.
Well, there are two kinds of EXE generators:
Ones that attack a minimal JRE to your JAR file
Ones that convert your code to native code
well both are harder to decompile that pure JAR file, but 2nd ones are more secure.
Well as far as I know native compilers are all commercial, so if you need a free converter, you just have 1st option. In that case I recommend you to use a (non flow) obfuscator (such as yGuard) first, and then convert the obfuscated JAR file to EXE.
Can anyone please tell me whether converting the .jar file to .exe is safe enough for distributing to any clients?
No, it isn't. Obfuscation can make it a little harder.

Using SASS for Java EE projects in Eclipse

I have already referred this question on SO but it is not the solution I'm looking for.
I'm a Java Web Developer, and so far for all CSS pre-processing needs, I've been using Less but now I want to move Sass due to its server-side rendering nature. But since it requires gem package manager and thus is more closer to Ruby then Java, how can I adopt it in my Java Web Applications that I develop in Eclipse?
Note that I'm not looking for Syntax Highlighting feature for .scss/.sass files in Eclipse, but I'd want that when my application is run on server from within Eclipse, the Sass is processed automatically and gets compiled to regular CSS. (Instead of running sass --watch outside Eclipse for each Sass file I create and save and include generated .css file separately in my web pages)
P.S. I'm using both Linux and Windows, but I primarily develop in Linux.
Some years have passed, but finally now there is a viable solution:
https://github.com/eclipse/wildwebdeveloper#-get-it-now
Integration of the Wild Web Developer with Eclipse is easy. It will compile your SCSS files to CSS files once they are changed. Besides this it supports lots of other features, such as code completion, code highlighting, validation and many more. You will need to install node.js to make use of all its features.

PHP/Java Eclipse

I've created a Java project in Eclipse that holds applet with Java perspective and another PHP project with PHP perspective that holds file that has javascript to communicate with the java applet.
Unfortunately I don't know how to setup the Java files into the PHP project so that the applet works from my localhost.
I had the applet somewhat working when I put the PHP files into Java project and ran it like that but I need it other way so that I can run from my PHP project.Anything is great. Thanks
Keep your Java and PHP projects completely separate. Keep in mind that you can serve up your Java applet in any number of ways, your PHP implementation is just one. With that knowledge in hand what you really want to do is to decide where your Applet bundle is going to live. I recommend you create a simple HTML file on your server and test loading the applet from whatever location you decide on. Then in your PHP file just write code to spit out the exact same HTML to the client.
put the PHP files into Java project ... wrong way!
Try using another tool to edit your PHP scripts. Setup XAMPP server for development environment.

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