Skip to content

Instantly share code, notes, and snippets.

View peterkir's full-sized avatar

Peter Kirschner peterkir

View GitHub Profile
#!/usr/bin/env jjs
function runTest() {
var URL = Packages.java.net.URL;
var LinkedHashSet = Packages.java.util.LinkedHashSet;
set = new LinkedHashSet();
set.add(new URL("http://Square.GitHub.io/"));
set.add(new URL("http://square.github.io:80/"));
set.add(new URL("http://google.github.io/"));
size = set.size();
if (size === 2) {
@peterkir
peterkir / io.klib.bintray.Delete.java
Created December 4, 2015 10:38
Deleting via JFrog Bintray REST API
package io.klib.bintray;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
@peterkir
peterkir / AppendToFile.java
Last active April 15, 2016 07:04
Java - parse log file, extract filelist and append to each file something
package io.klib.tools.files;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@peterkir
peterkir / CanonicalURLs.java
Last active April 18, 2016 05:22
java.net.URL obstacles with URL.equals
package issue.java.net.url;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedHashSet;
import java.util.Set;
public class CanonicalURLs {
public static void main(String[] args) {
@peterkir
peterkir / p2.publisher.FeaturesAndBundlesPublisher.cmd
Last active April 18, 2016 05:59
Publish a p2 repo from existing features and plugins (including valid md5 and artifacts sizes) - IGNORING binary artefacts
:: Publish an existing p2 repo with proper sizes for artifact and download and md5 checksums
SET ECLIPSE_SDK=c:\apps\eclipse-SDK-4.5.2-win32-x86_64\
SET EQUINOX_LAUNCHER_VERSION=1.3.100.v20150511-1540
SET REPO_SOURCE=C:/__publisher/exportIDE
SET REPO_TARGET=C:/__publisher/exportPublished
java -jar %ECLIPSE_SDK%\eclipse\plugins\org.eclipse.equinox.launcher_%EQUINOX_LAUNCHER_VERSION%.jar ^
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher ^
@peterkir
peterkir / TestJunction.java
Last active January 5, 2017 16:18
TestJunctionWithJavaNIO
package test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
/*
@peterkir
peterkir / gogo.sh
Created February 6, 2017 11:47
OSGi gogo shell examples
# Gogo Shell Command - inspect
help inspect
# inspect - inspects bundle capabilities and requirements
# scope: felix
# parameters:
# String ('capability' | 'requirement')
# String (<namespace> | 'service')
# Bundle[] target bundles
@peterkir
peterkir / bindex.cmd
Created February 6, 2017 11:59
Example of cmd line bindex call
#java -jar C:\tmp\BNDarchive\archive\dist\bundles\biz\aQute\bnd\org.osgi.impl.bundle.repoindex.cli\3.4.0-SNAPSHOT\org.osgi.impl.bundle.repoindex.cli-3.4.0-20161003.182247-1.jar ^
#-d C:/jbe5.0.2/repo/download.eclipse.org/eclipse/updates/4.6/R-4.6.1-201609071200 ^
#-n "Eclipse Platform R-4.6.1-201609071200" ^
#-v C:/jbe5.0.2/repo/download.eclipse.org/eclipse/updates/4.6/R-4.6.1-201609071200
java -jar C:\tmp\BNDarchive\archive\dist\bundles\biz\aQute\bnd\org.osgi.impl.bundle.repoindex.cli\3.4.0-SNAPSHOT\org.osgi.impl.bundle.repoindex.cli-3.4.0-20161003.182247-1.jar ^
-d C:/jbe5.0.2/repo/download.eclipse.org/releases/neon/201609281000 ^
-n "Eclipse Simultaneous Release 201609281000" ^
-v C:/jbe5.0.2/repo/download.eclipse.org/releases/neon/201609281000
@peterkir
peterkir / BlogPostTopics.md
Created October 29, 2017 22:48
Topics Blog posts

bnd

  • macros!!!

  • cascading includes of macro bndruns

  • usage of local repos/file uri (especially fileuri macro)

  • launch configs

  • bnd workspace templates

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.