Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,924 Members 45,364 Now Online
XDA Developers Android and Mobile Development Forum

[Lib][Java/JAR] RegIOLib - Java/Registry In/Out Communications Lib

Tip us?
 
Beatsleigher
Old
(Last edited by Beatsleigher; 22nd November 2013 at 08:11 PM.)
#1  
Beatsleigher's Avatar
Senior Member - OP
Thanks Meter 519
Posts: 1,051
Join Date: Oct 2011
Location: Somewhat around here : 52.366848,8.3345

 
DONATE TO ME
Angry [Lib][Java/JAR] RegIOLib - Java/Registry In/Out Communications Lib

Hey there,

I thought it was time to release something new

A bit of background storyline:

My last projects were all VB/.Net programs, and they were somewhat great, sure. But I was missing the Linux portability and the programs aren't available on all Windows version - Which bugged me a lot. So I finally started coding in Java again! I'm also porting Universal Android Toolkit to Java, so I can easily create a Linux version of that as well.
(If you want to make that happen faster, please donate to me. I managed to fix my laptop, but I've only got a 60GB HDD and I need that much space alone for Windows and I have no income, I'm only 16 )

Anyways, now that you know where I'm coming from, as I'm porting Universal Android Toolkit to Java, I need access to the registry to save the application's settings and easily access them. But unlike .Net languages, Java doesn't have built-in support for this kind of operation, so I looked around and grabbed bits and pieces of code and stuck them together into a Java Class Library.

Thus, RegIOLib was born.

It's licensed under the GPL 3.0 (License info included in the source).

Downloads
Sourceforge

Source Code
http://github.com/Beatsleigher/RegIOLib

EDIT:
I forgot to mention the following: To get access to the Windows registry, the application needs to be started with administrative rights!
You can either achieve this by starting the app via a launcher (Which is what I tempt to do) or by right-clicking the file and allowing it to run as admin.


My popular projects on GitHub
Universal Android Toolkit is now in BETA, JDroidLib is released!


My work (other) work:
"Nothing is infinite, except human stupidity." - Albert Einstein.
"You shouldn't trust everything you see on the internet." - Abraham Lincoln.

If you haven't already, add me to your circles on Google Plus
The Following User Says Thank You to Beatsleigher For This Useful Post: [ Click to Expand ]
 
Beatsleigher
Old
#3  
Beatsleigher's Avatar
Senior Member - OP
Thanks Meter 519
Posts: 1,051
Join Date: Oct 2011
Location: Somewhat around here : 52.366848,8.3345

 
DONATE TO ME
Quote:
Originally Posted by nikwen View Post
So closed source applications may not use it?
Of course they can use it
Just add a link to this thread and my website, done.

But if you're coming from some major company or something, then I would like something more


My popular projects on GitHub
Universal Android Toolkit is now in BETA, JDroidLib is released!


My work (other) work:
"Nothing is infinite, except human stupidity." - Albert Einstein.
"You shouldn't trust everything you see on the internet." - Abraham Lincoln.

If you haven't already, add me to your circles on Google Plus
 
nikwen
Old
#4  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1298
Posts: 2,690
Join Date: Feb 2013
Quote:
Originally Posted by Beatsleigher View Post
Of course they can use it
Just add a link to this thread and my website, done.

But if you're coming from some major company or something, then I would like something more
According to the GPL they can't because it requires the source code of derivative work to be published. That's the "problem" with that license if you use it for libraries.

Due to that the LGPL exists.
 
SixSixSevenSeven
Old
(Last edited by SixSixSevenSeven; 10th November 2013 at 01:22 PM.)
#5  
Senior Member
Thanks Meter 323
Posts: 1,620
Join Date: Dec 2012
http://www.tldrlegal.com/license/gnu...ense-v3-(gpl-3)

Limited commercial use. Must include source code. So no, GPL libraries and closed source applications do not mix.


An inelegant solution (which is the one I have always used actually) is to save settings in a file in %APPDATA%, no admin rights are required to edit files in there, or roll your own registry library for the application. Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.




Although I dont think saving into a registry key is really cross platform :P Neither is %APPDATA% but using the %APPDATA% method is simple file read/write so on a cross platform application you can simply change the filepath dependent on the current execution environment.
System.getenv("APPDATA") will return the filepath for the current users APPDATA folder on windows. System.getProperty("user.home") works on linux and I think OSX to get the home directory. I dont think user.home works properly on windows. But it should be easy to switch between the 2 methods, add on an extra bit for where your settings file is and detect which to use at runtime.

Disadvantage (and to some advantage, depends on what the application is doing and whether the author likes it or not) is that saving configuration files as actual files means the user can play around with them. APPDATA is by default a hidden folder. But chances are most users dont even know what the registry is so in a way your settings might be more secure left in there.

Even possible to have an application load settings from the registry on windows and files on everything else.
 
nikwen
Old
#6  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1298
Posts: 2,690
Join Date: Feb 2013
Quote:
Originally Posted by SixSixSevenSeven View Post
Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.
Of course, he has that right. It's his code. The GNU even collected some reasons for sticking with the GPL.
Just wanted to point out that the GPL says that all derivative work (which includes programs that use libraries licenced under the GPL) must be GPL'ed (and therefore open source'd), too.
 
Beatsleigher
Old
#7  
Beatsleigher's Avatar
Senior Member - OP
Thanks Meter 519
Posts: 1,051
Join Date: Oct 2011
Location: Somewhat around here : 52.366848,8.3345

 
DONATE TO ME
Quote:
Originally Posted by SixSixSevenSeven View Post
http://www.tldrlegal.com/license/gnu...ense-v3-(gpl-3)

Limited commercial use. Must include source code. So no, GPL libraries and closed source applications do not mix.


An inelegant solution (which is the one I have always used actually) is to save settings in a file in %APPDATA%, no admin rights are required to edit files in there, or roll your own registry library for the application. Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.




Although I dont think saving into a registry key is really cross platform :P Neither is %APPDATA% but using the %APPDATA% method is simple file read/write so on a cross platform application you can simply change the filepath dependent on the current execution environment.
System.getenv("APPDATA") will return the filepath for the current users APPDATA folder on windows. System.getProperty("user.home") works on linux and I think OSX to get the home directory. I dont think user.home works properly on windows. But it should be easy to switch between the 2 methods, add on an extra bit for where your settings file is and detect which to use at runtime.

Disadvantage (and to some advantage, depends on what the application is doing and whether the author likes it or not) is that saving configuration files as actual files means the user can play around with them. APPDATA is by default a hidden folder. But chances are most users dont even know what the registry is so in a way your settings might be more secure left in there.

Even possible to have an application load settings from the registry on windows and files on everything else.
No, as far as I'm aware, only Windows has a registry. I could be wrong though. In the past 5-6 years that I've been developing, I was only developing in VB.Net - A decision that I highly regret nowadays
But I'm so used to being able to save my settings in the registry where no 'normal' user can modify them and cause the program to misbehave, that I'd like my java programs to do so as well.

And seeming as Universal Android Toolkit is a big, big project (I've been developing it for over a year now and I'm constantly adding new features and now I'm porting it to Java making it really hard to release, but I'll get there eventually.

As soon as I've got the major stuff sorted out, I think I'm ready to release a Pre-Release candidate for testing and bug-fixing, but like I said, I'm still having some trouble and then I need to figure out a way to get those settings saved on Mac OS and Linux machines, for which I've already written some classes, but only to install ADB and stuff... And I'm getting side-tracked again, aren't I?

Anywhosers, I think I'm going to leave it under the GPL, even though you're right and that that means that closed-source programs can't use it, but I'll think of something. Even if it's a commercial license, say someone pays 2$ per program. I don't know.

But for the thing you said with %AppData%, what you can do on Linux machines, is (in Java)
Code:
Select Code
private final String userProf = System.getenv("user.home");
final File tempDir = new File(userProf + "/Temp/(.)<Program>/temp.file");

private void setupTempDir() {
    Path tmp = tempDir.getParentFile().getPath();
    if (!tmp.exists()) {
        tempDir.createNewFile();
    }
}
That should solve that problem, then you COULD create some sort of settings file, but then it's just a pain to get and save the settings when you're using multiple GUIs, like me.

And then there's another way of doing that in Android apps, which I haven't figured out yet, mainly because I haven't even started with Android apps and I don't have the hard drive space to do so :/


My popular projects on GitHub
Universal Android Toolkit is now in BETA, JDroidLib is released!


My work (other) work:
"Nothing is infinite, except human stupidity." - Albert Einstein.
"You shouldn't trust everything you see on the internet." - Abraham Lincoln.

If you haven't already, add me to your circles on Google Plus
 
nikwen
Old
#8  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1298
Posts: 2,690
Join Date: Feb 2013
Quote:
Originally Posted by Beatsleigher View Post
Anywhosers, I think I'm going to leave it under the GPL, even though you're right and that that means that closed-source programs can't use it, but I'll think of something. Even if it's a commercial license, say someone pays 2$ per program. I don't know.
OK, no problem. The GPL, however, says that you may not relicense it. :/
(All of my comments I've posted yet sound as if the GPL is a bad license. To clarify that: I don't think so. I prefer it for applications, but use the LGPL or Apache v2 license for libraries.)
 
Useless guy
Old
#9  
Recognized Developer
Thanks Meter 70
Posts: 247
Join Date: Jan 2010
Location: Moscow
Quote:
Originally Posted by Beatsleigher View Post
(If you want to make that happen faster, please donate to me. I managed to fix my laptop, but I've only got a 60GB HDD and I need that much space alone for Windows and I have no income, I'm only 16 )
I'm 17 and I have a 64GB SSD. C#, C++ works great.

Anyway 700 lines of license make no sense. The same about the portable registry library for linux. Could you tell the purpose of it?
PicoLyrics - Karaoke in your Windows Phone 7, huge database!

LG GW910 (Panther) WP7 7003
HTC HD7 WP7.1 7.10.8107.79
Acer Iconia Tab A500 ICS 4.0.3

If you have the way to update 7003 build to 7004 or higher, PM me!
 
SixSixSevenSeven
Old
#10  
Senior Member
Thanks Meter 323
Posts: 1,620
Join Date: Dec 2012
Quote:
Originally Posted by Useless guy View Post
I'm 17 and I have a 64GB SSD. C#, C++ works great.

Anyway 700 lines of license make no sense. The same about the portable registry library for linux. Could you tell the purpose of it?
GPL isn't 700 lines last time I checked, also I left a link to a simple description of it above (I do love tldrlegal).

There is no registry for linux, no one mentioned a portable registry for linux.

Tags
class library, java, lib, registry, windows
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Enjoy Wallpaper Overload with PhotoPhase

We don’t usually feature live wallpapers on the XDA Portal unless they are somewhat innovative … more

Monitor What Your Phone’s Camera Sees with Android Wear

Having a smart device strapped to your wrist certainly has its merits. A … more

Mod Lets You Have Stereo Speakers on Your Sony Xperia Z1 (Sort Of)

The stereo speakers onthe Sony Xperia Z2areprobably a relatively large … more

Give Your Screen Some Color with HexaTime Live Wallpaper

We don’t often cover very many live wallpapers here on the XDA Portal. You may … more