Skip to content

Instantly share code, notes, and snippets.

View shannah's full-sized avatar

Steve Hannah shannah

View GitHub Profile
package ca.weblite.hebrewtest;
import static com.codename1.ui.CN.*;
import com.codename1.system.Lifecycle;
import com.codename1.ui.*;
import com.codename1.ui.layouts.*;
import com.codename1.io.*;
import com.codename1.ui.plaf.*;
import com.codename1.ui.util.Resources;
@shannah
shannah / Example
Created February 17, 2024 15:27
Script to inject
bash update_jnf_linkage.sh /path/to/JavaNativeFoundation.framework.zip /path/to/MyApp.app
Download a prebuild JavaNativeFoundation.framework.zip at https://drive.google.com/file/d/1j9HCMNvlplIBdgG6zitfZqxYVM1seB-J/view?usp=drive_link
Or build it yourself from sources https://github.com/apple/openjdk/tree/xcodejdk14-release/apple/JavaNativeFoundation
@shannah
shannah / check_jnf_linkage.sh
Created February 17, 2024 15:18
Script to list all dylibs in an .app bundle that depend on JavaNativeFoundation
#!/bin/bash
# Usage message
usage() {
echo "Usage: $0 [-v] <directory>"
echo " -v Verbose mode. Display files and their JavaNativeFoundation dependencies."
}
# Check for verbose flag
VERBOSE=0
@shannah
shannah / main.c
Created January 20, 2022 15:07
Sample using JLI_Launch to launch JVM
#include <jni.h>
#include <string.h>
#include <objc/objc-runtime.h>
#ifdef _WIN32
#include <windows.h>
#define LIBTYPE HINSTANCE
#define OPENLIB(libname) LoadLibrary(TEXT(libname))
#define LIBFUNC(lib, fn) GetProcAddress((lib), (fn))
#!/bin/bash
set -e
echo "Building on platform $(uname -s)"
export CGO_CFLAGS="-I$JAVA_HOME/include"
if [ -d "$JAVA_HOME/include/darwin" ]; then
export CGO_CFLAGS="-I$JAVA_HOME/include/darwin $CGO_CFLAGS"
elif [ -d "$JAVA_HOME/include/linux" ]; then
export CGO_CFLAGS="-I$JAVA_HOME/include/linux $CGO_CFLAGS"
elif [ -d "$JAVA_HOME/include/win32" ]; then
export CGO_CFLAGS="-I$JAVA_HOME/include/win32 $CGO_CFLAGS"
#ifdef LINK_JVM
#ifndef jvm_h
#define jvm_h
#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
@shannah
shannah / Error.txt
Created January 19, 2022 17:21
JavaFX startup error
Jan. 19, 2022 8:54:27 A.M. com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @56380231'
Exception in thread "Thread-5" java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = Thread-5
at com.sun.glass.ui.Application.checkEventThread(Application.java:447)
at com.sun.glass.ui.Application.setName(Application.java:200)
at com.sun.javafx.application.PlatformImpl.lambda$setApplicationName$2(PlatformImpl.java:142)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
@shannah
shannah / tuxpin-dev-server.sh
Created December 21, 2021 16:49
Shellmarks server management script for Tuxpin
#!/bin/bash
echo "Running with ${serverStatus}"
PORT="9090"
TUXPIN_PATH=/path/to/tuxpin
URL="http://localhost:$PORT"
if [ ! -z "$startServer" ]; then
ACTIVE=$(lsof -P -i TCP -s TCP:LISTEN | grep "$PORT")
if [ ! -z "$ACTIVE" ]; then
if [ ! -z "$openOnStart" ]; then
open "$URL"
@shannah
shannah / ipa-shellmarks-sample.sh
Created December 19, 2021 15:24
A sample shellmarks script for getting entitlements from an IPA file.
#!/bin/bash
file_extracted="${file}-extracted"
if [ ! -d "${file_extracted}" ]; then
if [ ! -f "$file" ]; then
echo "Cannot find file $file"
exit 1
fi
mkdir "${file_extracted}"
cp "$file" "${file_extracted}/App.zip"
cd "${file_extracted}"
@shannah
shannah / cn1-update.sh
Created December 13, 2021 16:51
Script to update Codename one project
#!/bin/bash
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
UPDATE_JAR=$HOME/.codenameone/UpdateCodenameOne.jar
if [ ! -f $UPDATE_JAR ]
then
curl https://www.codenameone.com/files/updates/UpdateCodenameOne.jar > $UPDATE_JAR
fi