Opening Quadratic Sieve Jar file in Java - 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

Related

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

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.

Creating jar file directory across?

At first I have to say, that I've just started learning java a short while ago, so I'm not familiar with the language at all. Due to this, I try to get things done without using an IDE, so I can understand how things work. However, it's not the language that drives me crazy, but the process of making a .jar file.
I have the directories E:\Java\MyLib\mylib.java, E:\Java\Test\PartA\parta.java and E:\Java\Test\PartB\partb.java, which contains my main. mylib.java is a package that gets imported by parta.java, parta.java gets imported by partb.java.
I created a .bat file consulting several tutorials as much as the official specification from oracle about how to use the jar.exe, I've created a valid manifest.txt, I told the programm where it could find the partb.class containing my main, everything gets compiled to its own .class file just fine what tells me that my code is correct, but trying to merge all the files together into one .jar file took me hours without a working result.
According to any instructions I was able to find I'm doing everything right, I tried many different spellings and options, but at the end, either the compiler does not even find the files in the subfolders, or the files are in the .jar, but the javab.class is not able to find them during runtime.
It's sickening. I think I'm missing something, doing something absolutely wrong, but I can't figure out what it is. Any advice would be highly appreciated.
Use an IDE, it makes life so much easier. But, if you insist on doing things the old fashion way, try turning off your antivirus. If that doesn't work, check to make sure your environment variables are set correctly. If all else fails, try reinstalling your JDK.

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

C++ or Java Library for automated code editing?

I am writing/planning to write a program that takes in a java file (or multiple java files), and edits and adds functions/classes/variables and then outputs a new java file (or multiple files).
Is there a C++ or Java library that
Can recognize and output names of classes/functions within a text file
Can recognize and output the names of the input arguments for said classes/functions
Can allow me to insert code at specific lines or within specific functions
Can search for a given variable name/value
Maintains original file formatting
I would prefer not having to manually code something to do the above, so any help would be appreciated.
Thank you in advance!
EDIT: I currently use Eclipse, and am unsure of how to proceed. So to further explain my question:
In eclipse, if I write a program that opens another .java file, How would I go about 'asking' eclipse to output, say, all the class names of the .java file I just opened?
Also I will explain the 'purpose' of this project to further clarify. I want to write a program that can take in any java file, and turn it into a class that can implemented remotely via RMI. To do this I will need to add an execute() function, have the file implement Task and Serializable and add a few variables, etc... Based on my knowledge, doing this in Eclipse would require manual editing of the program, but I would like to completely automate this process.
Thank you, again.
Much of what you need can be found in a modern IDE; and some very good IDEs are open source (eclipse and Intellij IDEA Community Edition for Java). You might look there to see if there are modules that suite your needs.
Looks like you are talking of a tool like eclipse. You might not be looking for a full fledged IDE, but the requirements that you have mentioned are fulfilled by any basic IDE.
If you wish to make one of your own, you can do that using eclipse rich client platform.
All that you would need from Java is the reflection API.

incorporating .w files into a Java program

I am having trouble finding out what these .w files are and how to using them with my Java code: see Assignment1.zip at http://see.stanford.edu/see/materials/icspmcs106a/assignments.aspx
I would post a screenshot of my files, but I don't have enough "reputation points" to post an image on this site--I usually just read answers from others b/c I'm just learning. I can't open these .w files or else I would paste some of their contents in here.
For the past year, I've worked a good amount with Python and C++, but I decided to learn some Java from these free Stanford online lectures: http://see.stanford.edu/see/lecturelist.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111.
I've looked all over and simply cannot find out what .w files are, and I haven't been able to open them. I realize they're clearly worlds for the graphical robot to move around in, but I can't get the .java & .class files to function with these .w (or "world") files.
I would be happy to post some of my code in here as well, if you want. And I could post an image of the files & folders once I get a good enough reputation.
Could someone please help me?
You seem to be missing the documentation for karel.jar. There is already code for reading and working with these files, in sandford.karel.KarelWorld there is a load(File) method. But you will need to be working with the rest of the classes in the jar file, too, so you'll need to look for documentation (maybe given in the lecture videos?) or you'll have a very frustrating time.

Categories

Resources