Compile java to object files compatible with C/C++ - java

So I am working(actually still planning) on a GUI project, and I need control over every single pixel on the window. I have done a lot of Java and I know how to do that, the problem is that I want to do all the logic on C++(because I just love how it works) and I don't even know how to setup a GUI in C++(I already took a small look at Qt, but I haven't done anything great).
So I had this idea of writing all the GUI related things in Java and somehow compile java source files to object files that can be linked with the rest of C++ code. This is just a personal project I am working on so I don't care if I lose the cross-compatibility of Java.
Thanks to anyone who took time to read this.

Look into JNI. Years ago, when doing the game of life in programming class, I chose to have a C function do the pixel work, just like you are thinking of, because it, ahem, back then, made the graphics work run many times faster. Noticeably, back then anyway.
Write the Java Program and Compile
Generate header file from java class
Write the C Program
Generate Shared Library File
Run Java Program
Here's one of probably many resources to show you.

Related

how do i protect my java code in game maker extension

I release a new java based Game Maker Studio extension having spent many days putting it together.
Few downloads later someone decides it nice, they get your extension and the code and make their own copy/version and sell it on marketplace for much lower price. As I beleive the java code in the extensions is easily exposed.
So whats stopping people from copying and undercutting you?
I suppose you can obfuscate your code, java etc..
But thats not really hard to still copy and alter.
What else is there. I was thinking of wrapping the class into a jar file (mind you I know nothing about this) and then importing those and just referencing the functions/methods in the extensions .java file. Is this possible if so id like to know how.

Opening Quadratic Sieve Jar file in Java

I hope the title isn't misleading.. It was hard to come up with a proper name for this. Anyways, I'm trying to implement the Quadratic Sieve method for factoring integers in Java for problem solving purposes, as it will make my life a bit easier. I've tried to write the program myself, but it has a few flaws, rendering it unusable as of this moment.
So what I tried was to find a Java implementation of this Quadratic sieve method to locate my mistakes and correct if needed, or even use it.
I entered wikipedia at https://en.wikipedia.org/wiki/Quadratic_sieve at which the last implementation of Ariel, under the "implementations" section, is a Java implementation of this Quadratic Sieve method. I downloaded it and, unsurprisingly, it is a Jar file.. And opening it with "Java (TM) Platform SE Binary" doesn't work. Opening it with WinRAR later gives a list of a few folders that each contains lots of Classes within it.
Now, what I want is to somehow open all the classes and code written in that file, in my Eclipse IDE. Or a simpler explanation to this, is that I simply want to run this program in Eclipse, and view the code.
Question is, how do i do that :S?
Please be nice, I might be a good programmer, but I'm not as good in computers in general, try not to mock me :D
Thanks in advance, Matan.
You need the source files. They're not in the .jar, but you can get them here:
http://sourceforge.net/p/arielqs/code/HEAD/tree/src/
Click on "download snapshot" to get a .zip of all the sources

Copying all the DATA from SD card/USB pendrive

I've been learning Java for a month now. I've already managed to code some very simple stuff like prime number generator and a simple calculator. Now i'd love to try working on something more complex.
Here's my idea - I'd love to make a program that can copy pictures from SD card or USB with a single click (something that my parents can use very easily to copy all their photos to a folder without my help)
I was brainstorming quite a bit about it and before i start i want to ask following questions:
1. Are there any inbuilt Java methods that can help me with the following task?
2. What are the other (non-beginner) Java features that i'd need to read about?
I want to start it from the scratch, make it simple at first and progressively add more features to practice and learn some more.
Any pointers or tips much appreciated.
I'd suggest doing this as a script. The script can invoke java if you'd like to improve your java skills. However, scripting languages can also copy/move files very easily. If you choose java, read about file I/O, reading files, writing files, etc.
Here's a link for windows. Not sure what your operating system is, but you could create an executable script on mac, linux, etc.
http://www.wikihow.com/Write-a-Batch-File

Android app that called external .exe

I am about to make an app on android but I have 0 experience about it.
This project is important and kind of a big challenge to me.
With that being said, I will try my best to explain about it so you guyz can give me an accurate approach
So assuming I have a program written in C,C++. Either an .exe or bunch of library.
What this executable do is to process the data and generate a file with bunch of binary and weird output. This process is called pre-processing.
Then result file will then be fed into Matlab or python and the graphical result will be generated. This is called post-processing and also the final goal.
Right now I can't afford to get matlab installed so my boss only asked me to go up to the pre-processing part.
The project will be displaying the pre-processing on the screen of a android device even if it might be unreadable.
I have done some research and found several ways to accomplish this:
1/ write a simple app using java and use JNI to call the main function of the .exe
2/ write a simple app using c++ and get the result straight from the .exe
That's all i can come up with, can any expert give me some suggestions please.
I am looking for a solution that would get me pass the pre-processing phase but also be efficient and easy if I get a chance to work on post-processing phase later.
Thank you very much

Printing multiple file types using java

Hey i was wondering if there is a specific api for printing a bunch of common file types(pdf,doc,docx,txt, etc..). I am trying to develop program similar to HP's eprint. eprint annoys me because it prints an email as well as the file attached to it. I just want something i can send files directly to. I have found that java has a printing api, but that seems to focus on printing something from a gui window. any ideas much appreciated!
Thanks
Morpheous
It would be difficult for Java alone to be able to print a variety of different file types, and most of the time I've seen Java programs use other programs to do the printing by using Runtime.exec. If you're going to be trying to use this though, please be sure to read this extremely important article: When Runtime.exec() won't

Categories

Resources