Speed Up Deodexing with JoelDroid Batch Deodexer

Android 5.0 Lollipop brings many under-the-hood changes like changing the default compiler … more

Top 5 Apps for 2014 + Top Xposed Mod of 2014 – XDA TV

Its that time of year where you look back and remember the things that happened … more

NVIDIA SHIELD Tablet Gets Android 5.0.1, OTA Available

The NVIDIA SHIELD Tablet is the latest Android-powered device released by famed GPU … more

FXP Team Delivers Lollipop to Various Xperia Devices!

From all of us here at XDA-Developers, we’d like to wish you Happy Holidays! If … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP Beatsleigher

3rd November 2013, 04:58 PM   |  #1  
Beatsleigher's Avatar
OP Senior Member
Flag Somewhat around here : 52.366848,8.3345
Thanks Meter: 558
 
1,078 posts
Join Date:Joined: Oct 2011
Donate to Me
More
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.
Last edited by Beatsleigher; 22nd November 2013 at 09:11 PM.
The Following User Says Thank You to Beatsleigher For This Useful Post: [ View ]
10th November 2013, 09:33 AM   |  #2  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by Beatsleigher

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

So closed source applications may not use it?
10th November 2013, 12:05 PM   |  #3  
Beatsleigher's Avatar
OP Senior Member
Flag Somewhat around here : 52.366848,8.3345
Thanks Meter: 558
 
1,078 posts
Join Date:Joined: Oct 2011
Donate to Me
More
Quote:
Originally Posted by nikwen

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
10th November 2013, 12:56 PM   |  #4  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by Beatsleigher

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.
10th November 2013, 02:14 PM   |  #5  
Senior Member
Thanks Meter: 325
 
1,620 posts
Join Date:Joined: 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.
Last edited by SixSixSevenSeven; 10th November 2013 at 02:22 PM.
10th November 2013, 04:23 PM   |  #6  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by SixSixSevenSeven

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.
11th November 2013, 12:53 AM   |  #7  
Beatsleigher's Avatar
OP Senior Member
Flag Somewhat around here : 52.366848,8.3345
Thanks Meter: 558
 
1,078 posts
Join Date:Joined: Oct 2011
Donate to Me
More
Quote:
Originally Posted by SixSixSevenSeven

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:
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 :/
11th November 2013, 05:51 PM   |  #8  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by Beatsleigher

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.)
12th November 2013, 07:37 PM   |  #9  
Recognized Developer
Flag Moscow
Thanks Meter: 70
 
247 posts
Join Date:Joined: Jan 2010
More
Quote:
Originally Posted by Beatsleigher

(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?
12th November 2013, 07:44 PM   |  #10  
Senior Member
Thanks Meter: 325
 
1,620 posts
Join Date:Joined: Dec 2012
Quote:
Originally Posted by Useless guy

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.

Post Reply Subscribe to Thread

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

Advanced Search
Display Modes